[Bug 38046] New: AddRenewal dies due to daylight savings time issue and some other unknown factor
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38046 Bug ID: 38046 Summary: AddRenewal dies due to daylight savings time issue and some other unknown factor Change sponsored?: --- Product: Koha Version: 23.11 Hardware: All OS: All Status: NEW Severity: normal 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 We noticed recently if AddRenewal is run during automatic_renewals.pl between 2am and 3am, it will reliably crash for 1 Koha instance: {UNKNOWN}: Invalid local time for date in time zone: Australia/Sydney at /usr/share/koha/lib/C4/Circulation.pm line 3405 There is no valid Australia/Sydney time between October 6th 2:00am 2024 and October 6th 2:59am 2024, so I suspect that at some point during the AddRenewal process, there is an attempt to generate a DateTime object in the Australia/Sydney timezone within that datetime range. -- We're going to work around it by just making sure the automatic_renewals.pl cronjob doesn't run between 2am and 3am, but it's not a real solution... -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38046 --- Comment #1 from David Cook <dcook@prosentient.com.au> --- There is a HardDueDate which I think will be fetched with Australia/Sydney timezone... but with 00:00:00 time. October 7th is also a holiday... I keep thinking this is a Koha::Calendar bug but I'm not sure how yet... overall the time and time_zone handling looks OK. But there must be somewhere that the time for now() must be used with a time_zone of Australia/Sydney on October 6th... -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38046 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- Ok, I think that I've got it... my $datedue = dt_from_string(); $datedue->set_hour('02'); $datedue->set_minute('54'); my $dur = DateTime::Duration->new( days => 14); my $branchcode = 'CPL'; my $daysmode = 'Calendar'; my $calendar = Koha::Calendar->new( branchcode => $branchcode, days_mode => $daysmode ); -- The above will produce the fatal error: "Invalid local time for date in time zone: Australia/Sydney" -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38046 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- (In reply to David Cook from comment #2)
Ok, I think that I've got it...
Ooops, didn't copy the code quite correctly. my $datedue = dt_from_string(); $datedue->set_hour('02'); $datedue->set_minute('54'); my $dur = DateTime::Duration->new( days => 14); my $branchcode = 'CPL'; my $daysmode = 'Calendar'; my $calendar = Koha::Calendar->new( branchcode => $branchcode, days_mode => $daysmode ); $datedue = $calendar->addDuration( $datedue, $dur, 14 ); -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38046 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|AddRenewal dies due to |Koha::Calendar dies on |daylight savings time issue |invalid datetimes during |and some other unknown |addDuration() |factor | --- Comment #4 from David Cook <dcook@prosentient.com.au> --- Ok going to update the title from "AddRenewal dies due to daylight savings time issue and some other unknown factor" to "Koha::Calendar dies on invalid datetimes during addDuration()". The actual problem functions are used by addDuration(), so more investigation is needed, but yeah... not fun. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org