[Koha-bugs] [Bug 23079] Checkouts page broken because of problems with date calculation (TZAmerica/Sao_Paulo)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jun 10 17:46:32 CEST 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23079

--- Comment #4 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
(In reply to Katrin Fischer from comment #3)
> (In reply to Jonathan Druart from comment #1)
> Can you explain the issue a bit?

On Nov 3rd 2019, Brazil will skip from 00:00 to 1:00
(http://www.currenttimeonline.com/dst/dst.do?tz=America/Sao_Paulo), DateTime
consider it as an invalid date.
It is a problem when we are playing with dates without the time part (always
00:00).
When we instantiate a DateTime (from dt_from_string) we are already handling
this issue, and use the floating timezone (since bug 12669).

The problem remains when we generate a DateTime then add or subtract a
duration, which will result in an invalid date:

DateTime->new(year => 2019, month => 12, day => 3, time_zone =>
'America/Sao_Paulo')->subtract(days => 30);

=> Nov 3rd 2019, kaboom.

I think we should replace all the occurrences of dt_from_string->subtract (or
->add) with dt_from_string(undef, undef, 'floating'), to use the floating
timezone and avoid the error.

Technical note: we must update the prototype of dt_from_string before, to send
a hashref instead: dt_from_string({ timezone => 'floating'});

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list