We are implementing a calendar with React-datepicker.
It says Jan for January and Feb for February, but I would like to write numbers for the month instead of English.
If anyone knows how to do it, please let me know.
The same question came next.
If implemented accordingly:
import React, {useState} from "react";
import "react-datepicker/dist/react-datepicker.css";
import DatePicker, {registerLocale} from "react-datepicker";
import ja from "date-fns/locale/ja"; // register it with the name you want
registerLocale("ja",ja);
constApp=()=>{
const [startDate, setStartDate] = useState(newDate());
return(
<DatePicker
locale="ja"
selected = {startDate}
onChange={(date)=>setStartDate(date)}
dateFormat = "yyyy/MM"
showMonthYearPicker
/>
);
};
export default App;
© 2024 OneMinuteCode. All rights reserved.