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

[email protected] (Elliot Shank)
Newsgroups perl.datetime
Message-ID <[email protected]>
In the code below, why do the span sets not intersect when the spans taken from them do?

I've tried this code on both Red Hat 5.2 and on Mac OS X 10.5.

DateTime: 0.4501
DateTime::SpanSet: 0.25
DateTime::Event::Recurrence: 0.16

=======

next start 1: 2008-12-17T07:00:00
next end 1:   2008-12-18T07:00:00
next start 2: 2008-12-17T17:00:00
next end 2:   2008-12-18T17:00:00
spans intersect: yes
span sets intersect: no

=======

use DateTime;
use DateTime::SpanSet;
use DateTime::Event::Recurrence;

my $start_1 = DateTime::Event::Recurrence->weekly(days => 3, hours => 7);
my $end_1 = DateTime::Event::Recurrence->weekly(days => 4, hours => 7);
my $span_set_1 = DateTime::SpanSet->from_sets(start_set => $start_1, end_set => $end_1);

my $start_2 = DateTime::Event::Recurrence->weekly(days => 3, hours => 17);
my $end_2 = DateTime::Event::Recurrence->weekly(days => 4, hours => 17);
my $span_set_2 = DateTime::SpanSet->from_sets(start_set => $start_2, end_set => $end_2);

my $now = DateTime->now();

my $span_1 = $span_set_1->next($now);
my $span_2 = $span_set_2->next($now);

say 'next start 1: ', $span_1->start();
say 'next end 1:   ', $span_1->end();
say 'next start 2: ', $span_2->start();
say 'next end 2:   ', $span_2->end();

say 'spans intersect: ', $span_1->intersects($span_2) ? 'yes' : 'no';
say 'span sets intersect: ', $span_set_1->intersects($span_set_2) ? 'yes' : 'no';
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.