Closed Bug 282115 Opened 20 years ago Closed 20 years ago

toLocaleString not working together with Date.parse

Categories

(Core :: JavaScript Engine, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mcsmurf, Unassigned)

References

()

Details

This all happens with system locale German and timezone GMT+1
First create a new date with
var givenDate = new Date(0);
Then transform it to a localized string:
givenDate.toLocaleString(), returns Donnerstag, 01. Januar 1970 01:00:00
When you now feed this to Date.parse, as in
Date.parse(givenDate.toLocaleString()), it returns NaN
I'm not sure if this is a valid bug, at least there was a JS Testcase written
for it, see the URL (but at the time the testcase was written, toLocaleString
wasn't really working yet, see Bug 153586).
I don't think this is a bug.  Requiring Date.parse to handle all possible
outputs from Date.prototype.toLocaleString would be quite onerous indeed. 
toLocaleString is intended, IMO, for user-presentation purposes, and not as a
transport/transcoding format.
There is no requirement per ECMA-262 Edition 3, and no practical general
solution as shaver noted.

/be
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
Maybe 15.9.5.5.js and 15.9.5.6.js could then be altered and/or removed (since
these testcases aren't valid)?
Testcases are handled in Bug 282339.
You need to log in before you can comment on or make changes to this bug.