Bug 20311

Summary: get_age tests can fail on February 28th
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, martin.renvoize, nick
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
Attachments: Bug 20311: Prevent get_age tests to fail on Feb 28th

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:
2000-02-29T00:00:00
2000-02-28T00:00:00
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