| Summary: | Koha::Calendar dies on invalid datetimes during addDuration() | ||
|---|---|---|---|
| Product: | Koha | Reporter: | David Cook <dcook> |
| Component: | Circulation | Assignee: | Bugs List <koha-bugs> |
| Status: | NEW --- | QA Contact: | Testopia <testopia> |
| Severity: | normal | ||
| Priority: | P5 - low | CC: | gmcharlt, kyle |
| Version: | 23.11 | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
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... 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"
(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 ); 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. |
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...