On Fri, 1 Aug 2003, Eugene van der Pijll wrote: > I've encountered a bug in DT::Infinite math. It seems that adding a > number of days to DT::Infinite::Future results in a DT::I::Future object > again, but adding a number of years changes it. > > For example: > > my $dt = DateTime->now; > > my $dt_inf = DateTime::Infinite::Future->new; > print $dt_inf>$dt ? 'OK' : 'NOK', ' ', $dt_inf->year; > > $dt_inf->add( days => 20 ); > print $dt_inf>$dt ? 'OK' : 'NOK', ' ', $dt_inf->year; > > $dt_inf->add( years => 20 ); > print $dt_inf>$dt ? 'OK' : 'NOK', ' ', $dt_inf->year; > > Output: > > OK inf > OK inf > NOK -793 > > I presume that this is because the code for adding days is much simpler > than the code for adding months. I don't know how best to fix this; > perhaps a separate DT::Infinite::add_duration method?
Fixed with one line in DateTime.pm->add_duration ;) -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/