In javascript, I use Date.toLocaleDateStringto format my dates in a user locale. Although theoretically this should work, it is not.
I am in the UK. My computer is configured for the UK, and my default language is set to en / gb both in the system settings and in the browser content settings. However, Firefox always displays dates in US format. Is there any trick I'm missing?
The full formatting code is:
var timestamp = ...;
var dt = new Date(timestamp);
$('#audit-date').text(dt.toLocaleDateString());
In the UK today I expect to see 05/02/2014, but I see 02/05/2014, which is the American version.
source
share