]> git.koha-community.org Git - koha.git/commit
Bug 30061: Make Koha::Patron->get_age use DateTime math
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 9 Feb 2022 13:45:15 +0000 (10:45 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 22 Mar 2022 20:17:33 +0000 (10:17 -1000)
commit90a24b185c7e324cfadca1bdd77f387060b7cf03
treec250b4fff51ad80f72149e8382c1121def0bb714
parent296e3e618dca33ddf09c36b43471eae5f7755ce4
Bug 30061: Make Koha::Patron->get_age use DateTime math

This patch does what the title says. Instead of converting dates to
strings and performing math manually, we can just use the DateTime
objects we have and calculate the DateTime::Duration there's between
them, to get the years count.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patrons.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Patron.pm