We are currently showing JavaScript DateTime objects in the current user locale according to their language analog to this example (taken from MDN directly, since this matches our code but is already extracted):
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
console.log(new Intl.DateTimeFormat().format(date));
In general, this works great. American users get their twisted slashy format 11/20/2012
while German users get their ordered dotty format 20.11.2012
.
However, this only changes according to the language. The screenshot below shows a system locale setting that is different: English language but German DateTime format. In this case, the JavaScript example sadly shows the English format 11/20/2012
.
Since this is confusing some of our users, is there a way to retrieve the current system DateTime format setting or locale in order to render the JavaScript DateTime correctly? All the questions I found so far on Stackoverflow only concentrated on the user language and not the user system DateTime format setting.