Re: What am I not understanding about DateTime::SpanSet::intersects()?

[email protected] ("Flavio S. Glock")
Newsgroups perl.datetime
Message-ID <[email protected]>
2008/12/13 Elliot Shank <[email protected]>:
> Flavio S. Glock wrote:
>>
>> The intersects() method returns undef when it can't decide if there is
>> an intersection.
>
> But why can't it decide and how can I get it to?

Proving that two unbounded (infinite) recurrences intersect is
possible, but it is *really* difficult to implement a general case.

You can help it decide by being more specific about the time range.

If you specify a span, it will calculate if there is an intersection
for that specific span:

my $span_3 = DateTime::Span->from_datetimes( start =>
DateTime->new(year=>2001), before => DateTime->new(year=>2002) );
say 'span set intersected in 2001: ',
$span_set_1->intersection($span_set_2)->intersects($span_3) ? 'yes' :
'no';
# span set intersected in 2001: yes

---
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.