1

I'm using Intl.DateTimeFormat to format dates and I noticed that different browsers produce different results.

I used the following code to format date with Estonian locale:

new Intl.DateTimeFormat("et").format(new Date(2017,0,2))

Results I got:

  • Edge HTML 14.14393: ‎02‎.‎01‎.‎2017
  • Chrome 55.0.2883.87 m (Windows): 2.1.2017
  • Chrome Beta 56.0.2924.59 (Android): 2017-1-2

I'm quite unhappy with the result because I was hoping similar output. Why these differences exist and is it normal (expected)?

With locale en each browser gave same result (‎1‎/‎2‎/‎2017).

timukasr
  • 115
  • 7
  • i18n databases are huge and not all engine builds include all of them. Furthermore, there can be minor differences between vendors since they don't necessarily use the same data. – Álvaro González Jan 16 '17 at 15:34
  • 1
    To really ruin your day, try changing the interface language in Chrome. Swedish dates (locale = "se") will be formatted differently for each of these interface languages: English (US), English (UK), Swedish and Danish (there may be other variations, but that was enough testing for me). Why does the same method to return a locally formatted date return different results depending on the browsers own interface language? Intl is pretty useless the way it's been implemented so far. – Jakob Thorsdal Asmussen May 05 '17 at 08:37

0 Answers0