]> git.koha-community.org Git - koha.git/commit
Bug 16376 - Koha::Calendar->is_holiday date truncation creates fatal errors for TZ...
authorDavid Cook <dcook@prosentient.com.au>
Mon, 23 May 2016 01:57:04 +0000 (11:57 +1000)
committerMason James <mtj@kohaaloha.com>
Tue, 3 Jan 2017 01:22:43 +0000 (14:22 +1300)
commit06438c671a68f5d9f0b7caca56bf4e97cf7069b1
treea174651f32e58084c4a5604af06dfe99d06faa30
parent260b3c0920a1c6220b8f6b4e0517fc1c057d4bed
Bug 16376 - Koha::Calendar->is_holiday date truncation creates fatal errors for TZ America/Santiago

Using a DateTime object with a timezone of America/Santiago
was causing fatal errors for Koha::Calendar->is_holiday
and Koha::Calendar->exception_holidays, when the objects
were truncated to an invalid local time.

Using a floating zone allows us to use the same day, month, year
for comparison purposes without running into the possibility of
creating an invalid local time and thus a fatal software error.

Edit:

While the changes to is_holiday and single_holiday make sense (Jonathan agrees too)
I didn't manage to have them fail, because truncate is not failing in my trials, but
days_between. So to me, it narrows down to have exception_holiday return floating tz
datetime objects so it doesn't break days_between.

Anyway, it is ok to push this patch, and the regression test I provide covers this scenario
I'm describing.

To test:
- Apply the regression tests patch
- Run:
  $ prove t/db_dependent/Holidays.t
=> FAIL: Unexpected error due to bad timezone/date combination
- Apply this patch
- Run:
  $ prove t/db_dependent/Holidays.t
=> SUCCESS: Tests pass

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 32354d8322afd05704d87cb38d9bc032ce8c4ec1)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(cherry picked from commit 5e9056a99cf37acad6c2d4fe5f3ebd1f61171327)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Koha/Calendar.pm