-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Demo Site] A locale object was not found for the provided string ["en-GB"]. #1871
Comments
Closed with #1872 |
Yep, this is silly. |
This isnt fixed, even on your demo site with "en-GB" your input is still "en-US". i also get this console warning with "en-US" as locale. |
Same issue - not fixed. |
Bump |
From his commit on issue #1872 I checked he did 2 things:
import enGB from "date-fns/locale/en-GB";
registerLocale('gn-GB', enGB); So, in order to make it work in my code, I did the following: import React, { useEffect } from "react";
import DatePicker, { registerLocale } from "react-datepicker";
import enGB from "date-fns/locale/en-GB";
// REACT HOOK
const MyDatePicker = () => {
useEffect(() => {
registerLocale("en-GB", enGB);
}, []);
return (
<DatePicker
locale={'en-GB'}
/>
);
};
// React Component
class MyDatePickerComponent extends React.Component {
componentDidMount() {
registerLocale("en-GB", enGB);
}
render() {
return (
<DatePicker
locale={'en-GB'}
/>
);
}
} |
For me adding
|
Still not fixed. |
Still a problem |
Still a problem with pt-BR too |
If the issue is changing the start date of the week.
|
For anyone why the localisation is not working in the input field, there are actually separate 2 things going on here:
For fully localized datepicker, both are needed:
|
still a problem, but this is the best solution |
Describe the bug
The locale example on the demo site is not working correctly. It is using my locale (en-US) instead of the stated locale (en-GB). It is also produces an error. Error reproduced below
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expected date popup with correct local (en-GB in this instance).
Screenshots
Desktop (please complete the following information):
Additional context
Error procuced from console
The text was updated successfully, but these errors were encountered: