Bug 20311: Prevent get_age tests to fail on Feb 28th
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 28 Feb 2018 16:54:32 +0000 (13:54 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 28 Feb 2018 17:02:50 +0000 (14:02 -0300)
commit2201fda6c70442860cd8056326baa144adb912e1
tree54258eb106e6b3c9a63b942c2da82bba1f6b9490
parentf1c75f7bb54e8bc1a7f4a2aec293a2291dcd27be
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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Koha/Patrons.t