]> git.evergreen-ils.org Git - Evergreen.git/commit
LP#1774427 Parse DoB dates as whole dates
authorBill Erickson <berickxx@gmail.com>
Thu, 31 May 2018 14:58:38 +0000 (10:58 -0400)
committerKathy Lussier <klussier@masslnc.org>
Thu, 14 Jun 2018 14:17:27 +0000 (10:17 -0400)
commit055e6441dd15885db9640ed3dc5d6ba8d5352cf3
treeb008cee9e33ec2b4705424899eb2bb46e7fe6fd0
parentc5f0c487ffa9b2c8340bedf76ee9c2a12e2c2675
LP#1774427 Parse DoB dates as whole dates

Fixes DoB parsing in the browser client patron edit interface by
creating date objects from a whole YMD date string instead of compiling
the date as collection of pieces.  Compiling dates from pieces (calling
setFullYear(), setMonth(), etc.) can have unexpected consequences,
because a change of month can result in a change of days as well, if the
number of days in the date object exceeds the capacity of the selected
month.

For example:

---
> d = new Date()
2018-05-31T14:59:26.186Z
> d.setMonth(1)
1520092766186
> d
2018-03-03T15:59:26.186Z
--

Parsing as Date(YYYY,MM,DD) instead avoids this kind of shuffling.

To test

[1] Log in to the staff client on the 31st day of the month :)
[2] Change a patron's DoB to a month that does not contain 31 days.
[3] Save patron and note on reload, the DoB shows the wrong value.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js