in reply to DateTime::Span intersection inconsistencies

It therefore looks as though one nanosecond is going missing somewhere.

Is this intentional -- am I missing something to do with DateTime::Duration objects, or is this down to a bug in one of the DateTime modules?

I inserted this near the failing test

use DDS; diag Dump( $span->duration, $duration );
and it produced
# $DateTime_Duration1 = { # days => 0, # end_of_month # => 'wrap', # minutes => 0, # months => 0, # nanoseconds # => 0, # seconds => 3600 # }; # $DateTime_Duration2 = { # days => 0, # end_of_month # => 'wrap', # minutes => 60, # months => 0, # nanoseconds # => 0, # seconds => 0 # }; # bless( $DateTime_Duration1, 'DateTime::Duration' ); # bless( $DateTime_Duration2, 'DateTime::Duration' );
So it apperas that DateTime::Duration->compare is not normalizing the units so the comparison fails. I consider this a bug.

Replies are listed 'Best First'.
Re^2: DateTime::Span intersection inconsistencies
by mikeman (Acolyte) on Jun 30, 2011 at 13:51 UTC

    The problem is that DateTime::Span->intersects is producing different results depending on the method used to create the spans. I included the comparison to show that DateTime::Duration->compare considers both durations to be the same, not different.

      Oh wow, I am blind :)

      I would send bug upstream ASAP :)