I have encountered a bug in Intl.DateTimeFormat
MDN
Environment
Internet Explorer 11.0.6900.19080 on Windows 7
Bug
When only the "2-digit" option is used for month + day the function is not outputting any separators, be it /
for en
or .
for de
. This happens only in Internet Explorer on Windows 7. Internet Explorer 11 + Edge on Windows 10 is working. Not tested lower than 11.
Internet Explorer
Intl.DateTimeFormat('en', {month: "2-digit", day: "2-digit"}).format(new Date());
> "07 25"
Intl.DateTimeFormat('en', {year: "numeric", month: "2-digit", day: "2-digit"}).format(new Date());
> "07/25/2018"
Chrome
Intl.DateTimeFormat('en', {month: "2-digit", day: "2-digit"}).format(new Date());
> "07/25"
Intl.DateTimeFormat('en', {year: "numeric", month: "2-digit", day: "2-digit"}).format(new Date());
> "07/25/2018"
Context
I have used react-intl
when this error occurred and traced the error back to the native Intl.DateTimeFormat()
<FormattedDate
value={new Date()}
month="2-digit"
day="2-digit"
/>