Skip to content

Commit

Permalink
LP#1828114 Incorrect date of birth saved in certain time zones
Browse files Browse the repository at this point in the history
The Angular and AngularJS patron edit/register interfaces save
the birth date one day before the selected date if the client
device is set to a UTC+ time zone.

This patch converts the Date object to a formatted date string
without converting it to UTC.

To test:
1. Set your device time zone to a time zone after UTC
2. Edit a patron's date of birth in the AngularJS interface
3. Note the saved date of birth is 1 day earlier than expected
4. Repeat steps 2-3 for the Angular interface
5. Apply patch
6. Repeat steps 2 for both the Angular and AngularJS interfaces
7. Note the saved date of birth is as expected

Signed-off-by: Dan Briem <[email protected]>
Signed-off-by: Jason Stephenson <[email protected]>
  • Loading branch information
dbriem authored and Dyrcona committed Oct 17, 2024
1 parent 563d360 commit f4c4630
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ <h4 i18n>Preferred Name</h4>
fieldName="au-dob-input"
[noMaxWidth]="true"
[initialYmd]="patron.dob()"
(onChangeAsIso)="
(onChangeAsYmd)="
fieldValueChange(null, null, 'dob', $event);
afterFieldChange(null, null, 'dob')"
[required]="fieldRequired('au.dob')">
Expand Down
2 changes: 1 addition & 1 deletion Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ angular.module('egCoreMod')
patron.expire_date(patron.expire_date().toISOString());
patron.profile(patron.profile().id());
if (patron.dob())
patron.dob(patron.dob().toISOString().replace(/T.*/,''));
patron.dob(moment(patron.dob()).format('YYYY-MM-DD'));
if (patron.ident_type())
patron.ident_type(patron.ident_type().id());
if (patron.locale())
Expand Down

0 comments on commit f4c4630

Please sign in to comment.