How / Where does JavaScript determine the default locale?

Today, September 11, 2017, the JavaScript toLocaleDateString()method outputs 9/11/2017to me. But I'm in the UK, so formatting is wrong in this case. MDN Web Docs tell me that this method returns a "formatted string in the locale by default."

So where / how does JavaScript detect my standard locale? Where is this set, or what does it depend on, and (how) can I change it?

Edited to add: I am using Firefox 55.0.3 for Windows 10, if that matters.

+4
source share
2 answers

, . , .

:

ECMAScript, ( , Node.js), , ECMAScript Internationalization API (ECMA-402), :

DefaultLocale String, [...] .

, . , , , .

, , , , .

( Chrome):

Sample settings interface

+2

locale . . :

  var date = new Date().toLocaleDateString("en-GB");
0

Source: https://habr.com/ru/post/1685407/


All Articles