Opened 11 years ago

Closed 11 years ago

#5680 closed defect (fixed)

date parse uses default 1972, fromISOString uses 1970

Reported by: Douglas Hays Owned by: Adam Peller
Priority: high Milestone: 1.1
Component: Date Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description

Running dijit/form/test_timetextbox.html, the first textbox displays 5:45pm. Click this value to display the popup and then click outside the box to cancel. You see the onChange fires even though the value is unchanged. This is because the date object returned by the parser's fromISOstring() invocation has a year of 1970, but the date object returned by parse() inside the widget is 1972, and thus the dates differ. Attached is a patch to locale.js to make the default year = 1970 to be consistent with other date implementations. The defaults should also be documented somewhere.

Attachments (1)

5680.patch (414 bytes) - added by Douglas Hays 11 years ago.
code patch to locale.js to use 1970

Download all attachments as: .zip

Change History (3)

comment:1 Changed 11 years ago by Douglas Hays

Summary: date parse uses default 1972, fromISOString uses 170date parse uses default 1972, fromISOString uses 1970

Changed 11 years ago by Douglas Hays

Attachment: 5680.patch added

code patch to locale.js to use 1970

comment:2 Changed 11 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [12198]) build the Date object at the end, not as we go along. The setters on Date seem to have a bunch of issues. Calling the Date constructor once is more reliable and probably more performant. Also, use 1970 as the default year. Fixes #5716, #5680

Note: See TracTickets for help on using tickets.