From f4c4630991775be7a91fd88cf79581991f8f3479 Mon Sep 17 00:00:00 2001 From: Dan Briem Date: Wed, 18 Sep 2024 20:13:19 +0000 Subject: [PATCH] LP#1828114 Incorrect date of birth saved in certain time zones 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 Signed-off-by: Jason Stephenson --- Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html | 2 +- Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html index 5bd5b586f5..453e11c6bb 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html @@ -321,7 +321,7 @@

Preferred Name

fieldName="au-dob-input" [noMaxWidth]="true" [initialYmd]="patron.dob()" - (onChangeAsIso)=" + (onChangeAsYmd)=" fieldValueChange(null, null, 'dob', $event); afterFieldChange(null, null, 'dob')" [required]="fieldRequired('au.dob')"> diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index 2453460b29..828e3995b0 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -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())