Kevin M. Goess wrote: >perl -Ilib -MDateTime -MDateTime::TimeZone -e 'DateTime->new(time_zone >=> "America/Sao_Paulo", year => 2008, month => 10, day => 12)' >Invalid local time for date in time zone: America/Sao_Paulo
Midnight on that date doesn't exist in that timezone, because that's when DST goes into effect and so the clocks jump ahead to 01:00. >Upgrading to the very latest version of DateTime::TimeZone (released >yesterday) shows that the 12th now works, but the library fails on 19th >of October: Politicians, eh. They keep changing DST rules at the last minute. >Suggested fixes or workarounds? Depends what you're doing with the DateTime. Maybe you'd be better off using the UTC timezone, where there are no DST switches to screw things up. Or possibly the floating timezone, if you can't actually do your calculation in UTC. If you really need Sao Paulo time, because either you need to convert between that and something else or you need to see the DST effects, construct the DateTime with hour=>12, because no one switches DST at noon. This problem, of course, is why *almost* no one switches DST exactly at midnight. -zefram
