Locale prop not used
See original GitHub issueExpected behavior
I would like to use locale prop in my DatePicker, just like in the example:
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
locale="fr"
todayButton={"Aujourd'hui"}
/>
But, it seems to not work because it is still in English. My dependencies are:
"moment": "2.21.0",
"react": "16.2.0",
"react-dom": "16.2.0",
"react-datepicker": "1.2.2"
Steps to reproduce
I created a simple example in this CodeSandBox: https://codesandbox.io/s/5383o29jpx.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
React-intl for non components - Stack Overflow
Currently I have the following code to expose react-intl to non-components, but it throws an error for intl as undefined. I have created...
Read more >react-native-community/datetimepicker - npm
By default, the device's locale is used. Please note using this prop is discouraged due to not working reliably in all picker modes....
Read more >Context - React
Context provides a way to pass data through the component tree without having to pass props down manually at every level. In a...
Read more >Provider - React Spectrum - Adobe
Provider is the container for all React Spectrum applications. It defines the theme, locale, and other application level settings, and can also be...
Read more >How to validate React props using PropTypes - LogRocket Blog
Just like a function might have mandatory arguments, a React component might require a prop to be defined, otherwise, it will not render ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed by importing moment locale
Now wait… I simply set moment locale
moment.locale('fr')
and in the datepickerand it just works. No need to import the locale resources.