Closed
Bug 61183
Opened 24 years ago
Closed 24 years ago
Date.prototype.toLocaleDateString() : Y2K bug on Linux
Categories
(Core :: JavaScript Engine, defect, P3)
Tracking
()
VERIFIED
FIXED
People
(Reporter: pschwartau, Assigned: mike+mozilla)
Details
Attachments
(1 file)
(deleted),
patch
|
Details | Diff | Splinter Review |
Note that toDateString() is unambiguous about the year:
js> (new Date('January 1, 1900')).toDateString()
Mon Jan 01 1900
js> (new Date('January 1, 2000')).toDateString()
Sat Jan 01 2000
But toLocaleDateString() is ambiguous on my Linux box :
js> (new Date('January 1, 1900')).toLocaleDateString()
01/01/00
js> (new Date('January 1, 2000')).toLocaleDateString()
01/01/00
This leads to problems. For example, new Date() handles '01/01/00' this way:
js> new Date('01/01/00')
Mon Jan 01 00:00:00 GMT-0800 (PST) 1900
Therefore, constructs such as this produce a Y2K bug on Linux:
js> new Date((new Date('January 1, 2000')).toLocaleDateString())
Mon Jan 01 00:00:00 GMT-0800 (PST) 1900
This is causing testcase ecma_3/Date/15.9.5.6.js to fail on Linux.
On WinNT and Mac, there is no such problem with toLocaleDateString().
Assignee | ||
Comment 1•24 years ago
|
||
Seems reasonable to fix - usually with 'locale' stuff I leave it to the OS, but
I expect that there's some way to ask the OS politely for a 4-digit year. I had
to do that on windows with toLocaleString.
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•24 years ago
|
||
Assignee | ||
Comment 3•24 years ago
|
||
Roger, can you review?
What does toLocaleDateString do on windows?
Comment 4•24 years ago
|
||
Looks fine, r=rogerl. On Windows we use the same scheme as toLocaleString (only
%#x instead of %#c) and the OS generates a full year format (so far as I've
seen).
Assignee | ||
Comment 5•24 years ago
|
||
Fix checked in.
Assignee | ||
Comment 6•24 years ago
|
||
Marking fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 7•24 years ago
|
||
Verified on Linux - also checked WinNT and Mac.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•