From 6cf3f3bd55107772c5e860b6a79f991a6e80048c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 14 Apr 2022 09:14:47 +0100 Subject: [PATCH] Bug 30540: eval on set_time_zone This patch adds an eval around the call to set_time_zone so that we don't crash on invalid local dates and instead just keep the passed floating timezone. Signed-off-by: Nick Clemens Signed-off-by: Marcel de Rooy Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall (cherry picked from commit 6dab34fe66d41b367141f8e1b96abfe1729d045b) Signed-off-by: Andrew Fuerste-Henry (cherry picked from commit 7a1001d8bea4298bc830ebbe2d2a1d6ec5283815) Signed-off-by: Victor Grousset/tuxayo --- Koha/DateUtils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm index 9b599e3c6d..6d69852b53 100644 --- a/Koha/DateUtils.pm +++ b/Koha/DateUtils.pm @@ -255,7 +255,7 @@ sub output_pref { # FIXME: see bug 13242 => no TZ for dates 'infinite' if ( $dt->ymd !~ /^9999/ ) { my $tz = $dateonly ? DateTime::TimeZone->new(name => 'floating') : C4::Context->tz; - $dt->set_time_zone( $tz ); + eval { $dt->set_time_zone( $tz ); } } my $pref = -- 2.39.5