Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

intl.formatDate{epoch, month="short"or "narrow"} is not supported in IE11 win10. #335

Open
houfuchen opened this issue Jan 24, 2020 · 0 comments

Comments

@houfuchen
Copy link

ISSUE

  • SUMMARY:
    intl.formatDate, with the style attribute {month: "short"} or {month= "narrow"} not working on IE11 (Win10), but {month:"long"} works as expected (Code is attached at the end).

    - On IE11 (Win10), the date format is not as expected (same format for both short & narrow).
    - But {month: "long"} is accepted by IE, and showing the same results as the other browsers.
    - On other browsers, actual format is the same as expected.
    
  • QUESTION:
    Is this an IE problem or the intl problem?


Expected date format

Sep 09, 2019
(mmm dd, yyyy)

Actual date format

09-Sep-2019
(dd-mmm-yyyy)

Attempted Solutions

  • Tried to add an addition attribute in the style :
    - ({format: "mmm dd yyyy"}) ;
    - ({format: "mmm dd, yyyy"}) ;
    - ({format: "%m%d/%Y"}) ;
  • Installed polyfill;
  • Used Intl.DateTimeFormat instead of Intl.formatDate;
  • Used the {month: "long"} style attribute, and sliced the first three letters (this solution worked).
  • Installed i18n, and used I18n.strftime(dummydate,"%m%d/%Y");

Code

const dummydate = intl.formatDate(epoch, { ...style, year: "numeric", month: "short", day: "2-digit", timeZone: "UTC", }); return dummydate;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant