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

DateTimeFormat weekday long always shows short version #302

Open
grean opened this issue Jan 25, 2018 · 1 comment
Open

DateTimeFormat weekday long always shows short version #302

grean opened this issue Jan 25, 2018 · 1 comment

Comments

@grean
Copy link

grean commented Jan 25, 2018

Hi Andy,
In a react native project, i import latest intl (1.2.5) package :

Intl = require('intl');
require('intl/locale-data/jsonp/en.js');

and use it like this :
new Intl.DateTimeFormat('en', { weekday: 'long', day: '2-digit', month: '2-digit' }).format(new Date("2018-01-25T00:00:00"))

but it shows :
Thu, 1/25
instead of
Thuesday, 1/25

this code works great in normals browsers without polyfill in a react app.

In this file : intl/locale-data/jsonp/en.js, i've changed the value of (2nd gregory, there are two in this file , don't know why) gregory.days.short from 'Thu' to 'Thursday' and it changes the display to Thuesday, 1/25. I think the 'long' value of weekday option is not taken into account but only the short one.

Any idea ?

@christophehurpeau
Copy link

It seems it should be in formats to work. You can try to add in jsonp/en.js in date.formats.dateFormats:

EEEEMMdd: 'EEEE, MM/dd',

(for me it was MMMMEEEEd:"EEEE, MMMM d" for weekday: 'long', month: 'long', day: 'numeric')

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

2 participants