Bug 20311 - get_age tests can fail on February 28th
Summary: get_age tests can fail on February 28th
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
Depends on:
Reported: 2018-02-28 16:54 UTC by Jonathan Druart
Modified: 2019-10-14 19:56 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:

Bug 20311: Prevent get_age tests to fail on Feb 28th (2.64 KB, patch)
2018-02-28 17:02 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2018-02-28 16:54:18 UTC

Comment 1 Jonathan Druart 2018-02-28 17:02:10 UTC
Created attachment 72292 [details] [review]
Bug 20311: Prevent get_age tests to fail on Feb 28th

Today Feb 28th 2018:
If we subtract 18y to this DateTime object 29/02/2000 and so the patron is not major yet

use Koha::DateUtils qw( dt_from_string );
say dt_from_string('28/02/2018')->add(years => -18);
say dt_from_string('28/02/2018')->add(years => -18, end_of_month => 'limit');

will display:
Comment 2 Jonathan Druart 2018-02-28 17:03:21 UTC
Pushed to master for 18.05
Comment 3 Nick Clemens 2018-04-06 17:48:48 UTC
Awesome work all, backported to stable for 17.11.05
Comment 4 Fridolin SOMERS 2018-04-10 07:04:52 UTC
Pushed to 17.05.x for v17.05.11