Dave Rolsky schreef:
> However, if you add _days_ or months, the local time is left untouched,
> which can cause an exception if you do:
> 
>   my $dt = DateTime->new( year => 2003, month => 4, day => 5,
>                           hour => 2,
>                           time_zone => 'America/Chicago',
>                         );
>   $dt->add( days => 1 ); # kaboom

I don't like that at all. This means you have to trap exceptions
*everywhere* you do date math. Compare this with:

my $dt = DateTime->new( year => 2003, month => -4, day => 36,
                        hour => -52,
                        time_zone => 'America/Chicago',
                      );

which is silently accepted! (It's 2002-09-05T-52:00:00, which looks OK
except for the hour...)

I think it's better to return a somewhat sensible value (all dt's in
the missing hour are set to 03:00? 02:xx is changed to 03:xx?) than to
die. You might want to make this configurable (DateTime->use_strict ?).

Eugene

Reply via email to