[Koha-bugs] [Bug 30518] StockRotationItems crossing DST boundary throw invalid local time exception

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Apr 14 12:44:34 CEST 2022


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

--- Comment #4 from Nick Clemens <nick at bywatersolutions.com> ---
Created attachment 133296
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=133296&action=edit
Bug 30518: Correct DateTime maths for needs_advancing

The needs_advancing method prior to this patch used basic DateTime
arithmatic, adding a DateTime::Duration in Days to the Arrival date of
the item and then comparing that to today. This, however, can cause bugs
when the arrival + duration date coincides with a DST boundary and as
such may result in an invalid local date.  See
https://metacpan.org/pod/DateTime#Making-Things-Simple for further
details.

This patch updates the code to use the DST safe delta_days method to
count the days between arrival and now instead and then compares this
integer to the defined duration of the stage.

To test:
1. Re-run the unit tests, they should now pass.

Signed-off-by: Nick Clemens <nick at bywatersolutions.com>

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


More information about the Koha-bugs mailing list