Closed Bug 396798 Opened 18 years ago Closed 17 years ago

toLocaleString() of a date gives wrong results depending on locale

Categories

(Core :: JavaScript Engine, defect)

x86
OS/2
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mozilla, Unassigned)

References

()

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.9a8pre) Gecko/2007091902 SeaMonkey/2.0a1pre Build Identifier: Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.9a8pre) Gecko/2007091902 SeaMonkey/2.0a1pre The calcDiff function on the planet page uses then.toLocaleString() to output the current date for the present locale. Depending on locale this doesn't work. The input given to the toLocaleString() function currently is Wed Oct 17 2007 20:59:00 GMT+0200 (CEST) For de_DE and en_US this correctly outputs Mi 17 Okt 20:59:00 2007 Wed Oct 17 20:59:00 CEST 2007 respectively. However, for en_GB I get Wed 17 Oct 20:20:00 CEST 2007 (note 20:20 instead of the correct 20:59). I also tried pl_PL, there I get Žr. 17 X 2007 20:59:00 and while I am no expert in Polish language and dates, I am pretty sure that Poland formats their date differently. Especially the Z char with the circumflex on top is not Polish but Czech, in Polish I think it should be an S with accent on top. This is broken on at least 1.8 branch and trunk (I tried Firefox 2.0.0.5 on OS/2). Reproducible: Always
Attached file reduced testcase
A reduced HTML testcase adapted from the Planet Mozilla page.
The problem seems to be OS/2 specific. Using the testcase with Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a9pre) Gecko/2007100201 SeaMonkey/2.0a1pre I get: Wed Oct 17 2007 20:59:00 GMT+0200 (CEST) -> en_US: Wed 17 Oct 2007 08:59:00 PM CEST -> pl_PL: ´sro 17 pa´z 2007 20:59:00 CEST -> de_DE: Mi 17 Okt 2007 20:59:00 CEST -> en_GB: Wed Oct 17 20:59:00 2007 all of which seem correct to me. Can somebody enlighten me where in the JS code I could start debugging this?
http://mxr.mozilla.org/mozilla/source/js/src/jsdate.c#1830 See date_toLocaleString and date_toLocaleHelper.
OK, thanks Jeff. With that hint I found out that the call to strftime() in PRMJ_FormatTime gives wrong results. So it's most likely a problem of the C-library that comes with OS/2's GCC. I filed a bug with them: http://svn.netlabs.org/libc/ticket/187
I made a testcase for strftime() which shows the problem and attached it to the bug report for the C-library. So it's not a Mozilla bug. -> invalid
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: