Summary: | Simplify Koha::Patron->get_age | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | Architecture, internals, and plumbing | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | CLOSED FIXED | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | jonathan.druart, kyle, m.de.rooy, martin.renvoize |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
22.05.00
|
|
Circulation function: | |||
Attachments: |
Bug 30061: Make Koha::Patron->get_age use DateTime math
Bug 30061: Make Koha::Patron->get_age use DateTime math Bug 30061: Make Koha::Patron->get_age use DateTime math |
Description
Tomás Cohen Arazi (tcohen)
2022-02-09 13:44:04 UTC
Created attachment 130362 [details] [review] 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> Created attachment 131360 [details] [review] 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> Created attachment 131858 [details] [review] 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> Pushed to master for 22.05, thanks to everybody involved [U+1F984] |