0

We have an awkward problem with a couple of users in our organization. Let's say we can divide our user base in two populations:

  1. They are using some edition of Internet Explorer 11
  2. They are using some other edition of Internet Explorer 11. One difference we potentially see is that they are using the Dutch version of Internet Explorer 11.

We see the following behavior when trying out on the JavaScript console:

Testcase A

var x = new Date("1966-09-05")
new Intl.DateTimeFormat('nl-NL').format(x)
  1. Correct: "05-09-1966"
  2. Correct: "05-09-1966"

    x.toLocaleTimeString()

  3. Correct: "02:00:00"

  4. Correct: "02:00:00"

Testcase B

var y = new Date(1966, 8, 5)
new Intl.DateTimeFormat('nl-NL').format(y)
  1. Correct: "05-09-1966"
  2. Incorrect: "04-09-1966"

y.toLocaleTimeString()

  1. Correct: "00:00:00"
  2. Incorrect: "23:00:00"

With the mark "Incorrect" we use Chrome, Firefox, Safari, etc. as a reference implementation, assuming they have implemented the specification correctly.

It looks like that constructing a Date object with numeric parameters does not take daylight saving into account correctly. In one flow it is assuming "CEST" +02:00 Central-European Summer-Time and in the other flow it converts to "CET" +01:00 Central-European Time, substracting 1 hour of the clock, getting the date of the day before.

Can anyone explain to us why Internet Explorer 11 has this behavior on these specific set of workstations? Is there any (Microsoft) documentation that explains this?

Carl in 't Veld
  • 1,363
  • 2
  • 14
  • 29
  • 2
    Different browsers accept different non-standard date formats. The safest things to do are to always start from numeric timestamps (which has some issues, but it always gives you a Date at least); use ISO date/time format; or use a date parsing library like Moment that allows you to explicitly describe your date format(s). – Pointy Nov 26 '18 at 15:57
  • 1
    [`Date` (MDN)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date): _"Note: parsing of date strings with the Date constructor (and Date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies. Support for RFC 2822 format strings is by convention only. Support for ISO 8601 formats differs in that date-only strings (e.g. "1970-01-01") are treated as UTC, not local."_ – Andreas Nov 26 '18 at 16:14
  • According to 2018 daylight saving rules, that would have been during daylight saving. According to 1966, it was not daylight saving (Holland didn't observe daylight saving from 1946 until 1971). Previously, ECMAScript required implementations to observe current daylight saving rules as if they'd always existed, however since ECMAScript 2015 they've been required to observe all historic timezone changes if possible. – RobG Nov 26 '18 at 22:16
  • From your description, I can see that you are having an issue with dutch version of IE 11. Is this issue start occurring recently? If yes, then try to check whether is there any windows or IE related update got installed on that machine or not. It is possible that this update cause this issue with IE in that specific version. – Deepak-MSFT Nov 27 '18 at 03:20

0 Answers0