https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16376 Bug ID: 16376 Summary: Koha::Calendar->is_holiday date truncation creates fatal errors for TZ America/Santiago Change sponsored?: --- Product: Koha Version: 3.20 Hardware: All OS: All Status: NEW Severity: critical Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com Koha::Calendar->is_holiday calls the following DateTime truncate method: $localdt->truncate( to => 'day' ); This will truncate 2015-09-06 12:00:00 down to 2015-09-06 00:00:00. This causes major problems in Santiago, Chile, because 2015-09-06 is an invalid local time due to DST. I can't explain why it's a problem in 2015 because DST is weird in Chile in 2015, but it's obviously a problem for every other year as well: http://www.timeanddate.com/time/change/chile/santiago?year=2015 Consider 2014: 2014 Sunday, 27 April, 12:00 Midnight Sunday, 7 September, 12:00 Midnight You shouldn't have a problem on 27 April, because when 27 April 12:00 midnight hits (relative to UTC), local time is changed to 27 April 11:00pm. While UTC marches on, local time has been magically moved back an hour. You will have a problem on 7 September 12:00 midnight though, because that time doesn't exist. As soon as we roll over from 6 September 11:59pm to the next minute... we're actually on to 7 September 01:00:00am. Midnight doesn't exist on that day, which creates the following error in DateTime.pm: "Invalid local time for date in time zone: America/Santiago" This is a problem that the DateTime writer predicted. You can see their comments here: http://cpansearch.perl.org/src/DROLSKY/DateTime-1.26/lib/DateTime.pm https://rt.cpan.org/Public/Bug/Display.html?id=93347 We should probably do something like: eval { $dt->truncate(to => 'day'); } || warn "Eval failed with '$@'\n"; Why are we even doing this day truncation? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.