Closed Bug 409832 Opened 13 years ago Closed 3 years ago

JavaScript function toLocaleFormat does not provide localized names in Mac Os X


(Core :: JavaScript Engine, defect)

Not set





(Reporter: flod, Unassigned)



(1 file)

Example: evaluate in the error console 
alert(new Date().toLocaleFormat("%A %d %B %Y"));

On Mac Os X (Italian) you will see "Wednesday 26 December 2007", on Windows XP sp2 (Italian) "Mercoledì 26 Dicembre 2007".

Verified with 3.0b3pre (Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; it; rv:1.9b3pre) Gecko/2007122504 Minefield/3.0b3pre) but also with Firefox 2.0.0.x, both on Tiger and Leopard.

This a problem that involves also the localization process, since this function is used in the Download manager.
Tried in Linux (Debian Testing) and the problem doesn't show up.
Verified with 3.0bpre [Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b3pre) Gecko/2007122804 Minefield/3.0b3pre] and the 2.0.0.x version on the same operating system.
I can also confirm this with Polish Mac OS X 10.5 and Firefox 3.0b2.
Also, "new Date().toLocaleString()" results:

Safari: 30 grudnia 2007 17:04:39 GMT+01:00
Fx 3 b2: Sun Dec 30 17:05:00 2007
A screenshot of the download manager in Firefox 3prebeta3 showing why this bug is a major problem from a localizer's point of view.
nominating to get this on the radar.
Flags: blocking1.9?
Gavin nicely pointed out this is probably a dupe of bug 368838. Francesco, can you set your LANG environment variable and see if it fixes this? If it does, then this is a dupe of 368838.
> Gavin nicely pointed out this is probably a dupe of bug 368838. Francesco, can
> you set your LANG environment variable and see if it fixes this?

Thanks Bob, you (and Gavin) were right: If I open a terminal window (LANG is automatically set to it_IT.UTF-8) and start Firefox from command line, dates are localized in Italian (even if with some econding problems since accented letters are not correctly displayed).

Should I mark this bug as duplicate of 368838?
Francesco, thanks! I'll take care of it.
Closed: 13 years ago
Flags: blocking1.9?
Resolution: --- → DUPLICATE
Duplicate of bug: 368838
Comments in bug 368838 indicate that it is specifically about Number methods, not Date methods of the same name.
Resolution: DUPLICATE → ---
Assignee: general → nobody suggests not to use toLocaleFormat() and to use toLocaleString()/Intl.DateTimeFormat() instead.

new Date().toLocaleString("en-US"): 11/18/2014, 9:56:40 AM
new Date().toLocaleDateString(): 18.11.2014, 09:56:47
new Date().toLocaleDateString("pl"): 18.11.2014, 09:57:11
new Date().toLocaleString("pl",{weekday:"long",year:"numeric",month:"long",day:"numeric"}): wtorek, 18 listopada 2014
new Intl.DateTimeFormat().format(new Date()): 18.11.2014
new Intl.DateTimeFormat("en").format(new Date()): 11/18/2014

Wontfix as an effect of bug 769871?
Having it differ between Windows and Mac is odd, even if there's also a better API available.

That said, could we remove support for this non-standard API?
Another similar bug about toLocaleFormat: bug 476419
Duplicate of this bug: 476419
toLocaleFormat was removed in bug 818634.
Closed: 13 years ago3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 818634
You need to log in before you can comment on or make changes to this bug.