Bug 30705 - Updating the date of birth sometimes shows wrong age
Summary: Updating the date of birth sometimes shows wrong age
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-06 08:22 UTC by Katrin Fischer
Modified: 2024-04-13 12:30 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2022-05-06 08:22:07 UTC
To test:
- Edit a patron record
- Set date of birth to today 
- Note that the age hint claims the user is -1 year 11 months :(
Comment 1 Katrin Fischer 2022-05-06 15:24:53 UTC
Some more clues:

- the age hint only appears on editing, not when adding a patron and overwrites the format hint when clicking outside the input field
- dates in the past month calculate the age correctly
- dates in the current month, future and past, show the issue
- Example:  05/01/2022 (MM/DD/YYYY) Age: -1 year 11 months
Comment 2 Owen Leonard 2022-05-06 16:24:03 UTC
The write_age function seems to be a little buggy... If you pick a date which is less than one month ago it won't send an age string, so the date format hint is not replaced. If you pick a date more than one month ago and *then* pick a date less than one month ago (or you clear the field) the first age will remain.

The original patch adding the patron's age omitted handling of days, but it would be nice if it calculated the age in days *if* the date of birth is under one month ago.
Comment 3 Katrin Fischer 2022-05-06 17:41:57 UTC
Hm, you don't get the negative -1 and 11 months? Because that just seems plain wrong when the person is just a day old...
Comment 4 Owen Leonard 2022-05-06 17:52:51 UTC
No I don't get the negatives. I'm testing with Bug 30514, Bug 30706, and Bug 30713 applied.
Comment 5 Jonathan Druart 2022-06-01 12:24:37 UTC
I don't recreate the -1, however there is a bug:

- Select a date one year ago
=> Age 1 year OK
- Select today
=> Age 1 year KO

The date is not updated if a date in the last month is selected.
Comment 6 Katrin Fischer 2022-06-25 10:47:54 UTC
It's behaving a little different now:

1) Edit any existing patron, like Henry Acevedo
2) Notice he is 64 years old
3) Update the date to any past date in the current month
   -> the age hint doesn't update: 64 years
4) Change the date to a year back
   -> the age hint will now be updated: 1 year

It looks like it doesn't do the negative any more, but that it should always update the displayed date, even if it's 0 years?
Comment 7 Brendan Lawlor 2024-04-09 13:23:47 UTC
(In reply to Owen Leonard from comment #4)
> No I don't get the negatives. I'm testing with Bug 30514, Bug 30706, and Bug
> 30713 applied.

I don't see this bug in the current master. It looks like it was resolved by these patches in 22.05
Comment 8 Katrin Fischer 2024-04-13 12:30:32 UTC
Thanks for testing Brendan, happy to close this :)