date-time-format-timezone icon indicating copy to clipboard operation
date-time-format-timezone copied to clipboard

Formatting of timezone fails in IE11

Open scott-newman-infor opened this issue 5 years ago • 0 comments

https://github.com/formatjs/date-time-format-timezone/blob/1501228ef88367f79dd4ed8a788ce802f705b7d6/src/code/lookup-utill.js#L64

This line fails because the IE11 Date constructor doesn't like the "from" or "to" formats found in the timezone data. We only see a problem when there is more than one entry in metaNameData since otherwise it picks it automatically. For example I tried "America/Anchorage".

Full command line example: new Date().toLocaleString("en-US",{timeZoneName: "short", timeZone: "America/Anchorage"})

Try this on the command line and see it fail in IE but work elsewhere: new Date("1983-11-30 09:00-08:00")

Now replace the space with "T" and it works. new Date("1983-11-30T09:00-08:00")

So that's the fix. Replace space with "T".

scott-newman-infor avatar Jun 26 '19 16:06 scott-newman-infor