javascript toLocaleDateString output format YY-MM-YYYY

Bug #752007 reported by Phil Duby
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
firefox (Ubuntu)
Confirmed
Undecided
Unassigned
javascript-common (Ubuntu)
Invalid
Undecided
Unassigned
langpack-locales (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: firefox

Ubuntu 10.04 LTS - Lucid Lynx
package: firefox : Firefox 3.6.16
Locale: Lang en_CA
echo $LANG en_CA.utf8
echo $LANGUAGE en_CA:en_GB:en_IE: ...
no overrides in /etc/environment
A sample javascript generated calendar was displaying all of the day numbers as '11'. Some testing with a range of dates shows that the toLocaleDateString() method is showing all dates in YY-MM-YYYY format. Other date formating methods: toDateStriing, toLocaleString, toUTCString give correct results.
*probably* this is a problem with the default locale settings, but I do not know how to find out what 'package' that is, or how to use an alternate path (outside firefox) to verify that. All of the other ubuntu date text that I can 'see' are correct, but [from formatting] appear to be using one of the other locale specific methods and formats

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in firefox (Ubuntu):
status: New → Confirmed
Revision history for this message
Vancouverite (sethgilchrist) wrote :

There is more info on this posted in this Zotero Forum:

http://forums.zotero.org/discussion/21431?page=1#Item_18

Basically, if you put in a date as a string like "July, 2 2010" with the command [code]var d = new Date("July 2, 2010")[/code], the method [code]d.toLocaleDateString()[/code] gives the output "10-07-2010".

Dan at zotero wrote the code:
""
<pre id="output"></pre>
<script>
var str = "";

var d = new Date("July 2, 2010");

str += "Date is " + d + "\n\n";
str += "toLocaleString: " + d.toLocaleString() + "\n";
str += "toLocaleDateString: " + d.toLocaleDateString() + "\n";

document.getElementById('output').appendChild(document.createTextNode(str));
</script>
""

which produces an output of
""
Date is Fri Jul 02 2010 00:00:00 GMT-0700 (PDT)

toLocaleString: Fri 02 Jul 2010 12:00:00 AM PDT
toLocaleDateString: 10-07-2010
""

Revision history for this message
Phil Duby (philduby) wrote :

With the reminder from other people updating, I retested this. Same issue using Ubuntu 11.10 and FF 9.0.1 with latest updates
$echo $LANG
en_CA.UTF-8
$ echo $LANGUAGE
en_CA:en
This is from an 'out of the box' install of Ubuntu to a VirtualBox VM.
Since there are so few people noticing, this **really** looks like an issue related to locale en_CA
I guess I need to spin up a new Ubuntu VM with alternate settings to confirm

Revision history for this message
Phil Duby (philduby) wrote :

Got that new VM created.

Works just fine:

Ubuntu 11.10 and FF 9.0.1 with latest updates
$echo $LANG
en_US.UTF-8
$ echo $LANGUAGE
## blank ##

VERY strong indication that the problem is related to locale information. en_CA fails, en_US works.
Anyone have an idea about what 'package' this really belongs with? I could put it under one of the javascript packages instead of firefox, but it really belongs to a lower level. I just do not know which underlying library toLocaleDateString belongs to or calls. I add javascript and locales.

Sigh ... Something ELSE that should be in my web application cross browser / cross OS internationalization testing, but is just too big to be reasonable.

Revision history for this message
Croque (pcroque) wrote :

I have this problem too running Lubuntu 11.10 and Firefox 10.0.2. Happens with the Zotero plugin.

Enter the date in ISO format 2011-01-15...click out of the field and it shows 11-01-2011.

Revision history for this message
Croque (pcroque) wrote :

Oh, I guess I should add that my system locale is: en_CA.utf8

Revision history for this message
Alan Trick (trick) wrote :

I have this problem too, using Linux Mint with Firefox 12 and only Firebug installed. I have the `en_CA.UTF-8` locale.

Revision history for this message
Jean-Michel Vourgère (jmv-deb) wrote :

javascript-common package only expose /usr/share/javascrit content in /javascript URL.
That bug is not related to that package.

Changed in javascript-common (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.