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:
Scroll up or down to reproduce the.
See error in Additional Context
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
backend.js:6 A locale object was not found for the provided string ["en-GB"].
r @ backend.js:6
we @ index.js:403
(anonymous) @ index.js:552
(anonymous) @ index.js:2459
(anonymous) @ index.js:2445
(anonymous) @ index.js:2442
(anonymous) @ index.js:2654
(anonymous) @ index.js:2708
value @ index.js:2836
yi @ react-dom.production.min.js:3880
mi @ react-dom.production.min.js:3871
Jo @ react-dom.production.min.js:6116
Wo @ react-dom.production.min.js:5101
Ho @ react-dom.production.min.js:4958
Fo @ react-dom.production.min.js:4817
(anonymous) @ react-dom.production.min.js:2543
a.unstable_runWithPriority @ scheduler.production.min.js:338
cr @ react-dom.production.min.js:2513
Rr @ react-dom.production.min.js:2538
hr @ react-dom.production.min.js:2528
Ie @ react-dom.production.min.js:6706
Bn @ react-dom.production.min.js:1817
Ln @ react-dom.production.min.js:1790
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'}
/>
);
}
}
Most helpful comment
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.