You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I do import * as dateFnsLocales from 'date-fns/locale';
dateFnsLocales will be with a type of Module but not actually a Map. This makes it difficult to play with when I want to get a specific locale based on a user's locale.
dateFnsLocales[locale] has type error, I can not do if (locale in dateFnsLocales) as well.
This discussion was converted from issue #1805 on May 26, 2020 11:51.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
If I do
import * as dateFnsLocales from 'date-fns/locale';
dateFnsLocales
will be with a type of Module but not actually a Map. This makes it difficult to play with when I want to get a specific locale based on a user's locale.dateFnsLocales[locale]
has type error, I can not doif (locale in dateFnsLocales)
as well.The only way I can see is to do as in https://github.com/Adphorus/react-date-range/blob/master/src/locale/index.js. By exposing all locales again, I can then import locales as a map.
It's weird.
Beta Was this translation helpful? Give feedback.
All reactions