Closed Bug 223666 Opened 21 years ago Closed 21 years ago

Date.toLocaleString() generates uncaught exception

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: klassphere, Unassigned)

Details

(Keywords: regression)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6a) Gecko/20031025
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6a) Gecko/20031025

This simple script generates "Error: uncaught exception: null" in Javascript
console, at toLocaleString(). It's regression.

<html>
<body>

Unix time 1067094850 is:
<script language="JavaScript">

function getDate(t)
{
	var d = new Date;
	d.setTime(t * 1000);
	return d.toLocaleString();
}

document.write(getDate(1067094850));

</script>

</body>
</html>

Reproducible: Always

Steps to Reproduce:



Expected Results:  
toLocaleString() shows platform/locale-dependent date string.
Keywords: regression
Attached file Testcase
WFM using a recent CVS build on Linux.
The script worksforme in the current optimized JS shell on Win2K:

js> function getDate(t)
{
    var d = new Date;
    d.setTime(t * 1000);
    return d.toLocaleString();
}

js> print(getDate(1067094850));
Saturday, October 25, 2003 08:14:10

js> print(getDate(1067094850));
Saturday, October 25, 2003 08:14:10

js> print(getDate(1067094850));
Saturday, October 25, 2003 08:14:10



Note, a fix for Date.prototype.toLocaleString() was just recently checked in:
see bug 153586, "Date.prototype.toLocaleString() not implemented correctly"

Cc'ing folks from that bug. 

kl@cosmos-21.com (KL): what locale settings are you using?
Comment #3:

My locale is Japanese, on Windows XP obviously.
WFM BuildId 2003102323 on Red Hat Linux, LANG=ru_RU.UTF-8.
I successfully reproduced this bug with Mozilla/5.0 (Windows; U; Windows NT 5.0;
en-US; rv:1.6a) Gecko/20031026 Firebird/0.7+.

1)  Tools | JavaScript Console
2)  Open testcase URL
Patch of bug 153586 has been backed out to allow a 1.6a release
while the problems of toLocaleString on non-unix style platforms
are investigated.
Works again in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6a)
Gecko/20031029 Firebird/0.7+, possibly because of backing out.
But this time I got different string from before regression (I had got string
with Japanese characters, but it's all in English now, though not significant
change)
Based on KL's findings, resolving this bug as WORKSFORME.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: