[Koha-bugs] [Bug 16376] Koha::Calendar->is_holiday date truncation creates fatal errors for TZ America/Santiago

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon May 30 03:07:16 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16376

--- Comment #13 from David Cook <dcook at prosentient.com.au> ---
(In reply to Jonathan Druart from comment #11)
> Ok you will remove the software error, but I am not sure it's the way to go.
> 

I would certainly prefer a more thorough overhaul of Koha's DateTime handling,
but I think this is good enough for now. Chile can't use the overdue
functionality in Koha at all at this stage without this fix.

> Currently the dates are stored in local time (so with the tz), if we want to
> switch to floating time zones (what we should do at some point!) I think we
> should recalculate all dates present in DB.
> An easy workaround would be to use Koha::DateUtils, which deals (at least
> try to) with invalid dates due du DST.

Well, we calculate and interpret the dates using local time, but they're stored
without timezone in the database.

So I'm not sure what you mean by "recalculate all dates present in DB". The
only difference between "local" and "floating" is the timezone. They're the
same numbers, so there would be no recalculation to do. Or do you mean we
should recalculate into UTC?

Even if it were stored in UTC, it would need to be converted to local, and then
to floating for the actual date handling, as we'd need the local numbers before
doing any datetime math/truncation for the holiday checks.

I have my reservations about Koha::DateUtils... I don't think enough thought
has been put into its implementation. Besides, it wouldn't work in this case.

Jonathan, the main problem at the moment is that Koha::DateUtils produces a
valid local time, so it uses the local timezone. During the
$calendar->days_between(), a day is added to this local datetime to produce
another valid local time. However, the act of truncating that valid local time
creates an invalid local time. So Koha::DateUtils isn't going to know there's a
problem until it's too late. You could implement your own wrapper around
DateTime, but I think that's getting excessive. We just need to be thoughtful
and careful in our handling of dates and time.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list