Opened 10 years ago

Closed 10 years ago

#9281 closed defect (fixed)

dojo.date.stamp.fromISOString fails for "0001-01T00:00:00"

Reported by: erin.stanfill Owned by: Adam Peller
Priority: high Milestone: 1.4
Component: Date Version: 1.3.0
Keywords: Cc:
Blocked By: Blocking:

Description

dojo.date.stamp.fromISOString("0001-01-01T00:00:00") returns a data object with the year set to 1901 instead of 0001. My application is communicating with a server written in .net and this is the string representation of DateTime.MinValue in .net.

Change History (4)

comment:1 Changed 10 years ago by Adam Peller

The limitation is noted in the inline documentation -- see summary for fromISOString.

This was discovered a while back (see r12561) There's a commented out line in stamp.js that will solve the problem. Look around line 64:

		result.setFullYear(match[0]||1970); // for year < 100

Problem is, this impacts performance. We were trying to keep this method very fast and didn't have a real use case for why someone would need support for "year 1". It sounds like we'll have to consider. There's the workaround, in the meantime.

comment:2 Changed 10 years ago by Adam Peller

seems like we could put this in a conditional and not pay much penalty for the common case, just add a bit more bloat to the method.

comment:3 Changed 10 years ago by Adam Peller

Milestone: tbd1.4
Priority: normalhigh

comment:4 Changed 10 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [20417]) Add branch for year < 100, apparently used by .net. Fixes #9281

Note: See TracTickets for help on using tickets.