I am using react-datepicker NPM package,
I tried to follow documentation but I was unable to import
registerLocale
and
import React, { Component } from 'react';
import DatePicker, { registerLocale } from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import ja from "date-fns/locale/ja";
registerLocale("ja", ja);
class App extends Component {
constructor(props) {
super(props);
this.state = {
date: new Date()
}
this.handleChange = this.handleChange.bind(this);
}
handleChange(date) {
this.setState({
date
});
}
render() {
return (
);
}
}
export default App;
I could get the result you wanted. And I tried to make it with moment
library but it didn't work on my code. sorry