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)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 10 Apr 2018 07:04:09 +0000 (09:04 +0200)
commit2342acfca77a2352a76ec6cca267e6a056dedf34
treea5dbdf5b921847e56fe67bbf79ac95cc952db43f
parent48141d57f1d5e124e60b85221926d55fae470a94
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>
(cherry picked from commit 72de4ddaeed5e12a86414e6b965cb6f5a4a76ce1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
t/db_dependent/Koha/Patrons.t