Re: working around nonexistent DateTimes (thanks to DST)

[email protected] (Zefram)
Newsgroups perl.datetime
Message-ID <[email protected]>
Thomas Klausner wrote:
>The only potential deal-breaker is the fact that if you now create a new 
>DateTime that does not exists, you'll get the next valid time instead of 
>an exception

Getting an exception in this situation is a feature, not a bug.  Finding
the next valid local time is potentially useful behaviour, but it needs
to be invoked explicitly, perhaps by an extra constructor parameter.

>Oh, and requesting a specific non-existed time also has strange results:
>~$ perl -MDateTime -E 'say 
>DateTime->new(year=>2012,month=>10,day=>21,hour=>0,minute=>30,time_zone=>"America/Sao_Paulo")'
>2012-10-21T01:30:00

If you're going to advertise this feature as "find the next valid local
time", you need to handle cases like this correctly.

-zefram
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.