I cannot recreate this, however, we have sites that experience automatic_renewals.pl crashing with: Invalid local time for date in time zone: America/New_York It seems to happen around the daylight savings change There is: DateTime->now( time_zone => C4::Context->tz() ) In C4::Circulation::CanBookBeRenewed but I can't purposely make that fail
We should not use DateTime directly, but dt_from_string from Koha::DateUtils instead. See also bug 23079 for more info. To recreate: use DateTime; say DateTime->new(year => 2020, month => 3, day => 8, hour => 2, time_zone => 'America/New_York'); I guess your auto renew cronjob run at 2am.
Created attachment 101802 [details] [review] Bug 24840: Replace DateTime->now with dt_from_string We should use Koha::DateUtils instead of Date::Time directly This patch simplay replaces calls to now() with a call to dt_from_string() which does effectively the same thing. Probably reading the code and verifying changes is sufficient but... To test: 1 - confirm the files all compile 2 - confirm all tests pass 3 - confirm Koha still works
Created attachment 102542 [details] [review] Bug 24840: Replace DateTime->now with dt_from_string We should use Koha::DateUtils instead of Date::Time directly This patch simplay replaces calls to now() with a call to dt_from_string() which does effectively the same thing. Probably reading the code and verifying changes is sufficient but... To test: 1 - confirm the files all compile 2 - confirm all tests pass 3 - confirm Koha still works Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 102543 [details] [review] Bug 24840: Catch some further cases of DateTime->now This patch corrects a few additional cases where DateTime->now is called directly instead of via Koha::DateUtils.
Tests all continue to pass.. looks good to me. Signing off
Created attachment 102550 [details] [review] Bug 24840: Replace DateTime->now with dt_from_string We should use Koha::DateUtils instead of Date::Time directly This patch simplay replaces calls to now() with a call to dt_from_string() which does effectively the same thing. Probably reading the code and verifying changes is sufficient but... To test: 1 - confirm the files all compile 2 - confirm all tests pass 3 - confirm Koha still works Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 102551 [details] [review] Bug 24840: Catch some further cases of DateTime->now This patch corrects a few additional cases where DateTime->now is called directly instead of via Koha::DateUtils. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Great patch Nick, we really needed that!
Nice work everyone! Pushed to master for 20.05
does not apply to 19.11.x branch. please rebase if needed.
Created attachment 104438 [details] [review] Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string We should use Koha::DateUtils instead of Date::Time directly This patch simplay replaces calls to now() with a call to dt_from_string() which does effectively the same thing. Probably reading the code and verifying changes is sufficient but... To test: 1 - confirm the files all compile 2 - confirm all tests pass 3 - confirm Koha still works Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Bug 24840: Catch some further cases of DateTime->now This patch corrects a few additional cases where DateTime->now is called directly instead of via Koha::DateUtils. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Thanks for the rebase - backported to 19.11.x for 19.11.06