import React, {useState} from 'react';
import DatePicker from 'react-datepicker';
import ja from 'date-fns/locale/ja'; //日本語カレンダーのImport
export const App = () => {
const Today = new Date();
const [date, setDate] = React.useState(Today);
return (
<div>
<form>
<label>
<DatePicker dateFormat="yyyy-MM-dd" //フォーマット指定
selected={date}
maxDate={Today} //過去日のみを選択可能にする
filterDate={date => date.getDay() === 1} //月曜日指定の場合、1
locale={ja} //日本語カレンダーにする
onChange={selectedDate => { setDate(selectedDate || Today) }} />
</label>
<Button onClick={} text='検索' />
</form>
</div>
);
};
export default App;
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme