react-modern-calendar-datepicker
react-modern-calendar-datepicker copied to clipboard
Simple examples in typescript doesn't work
Describe the bug A clear and concise description of what the bug is. import React from 'react' import DatePicker, { DayValue, DayRange, Day } from 'react-modern-calendar-datepicker'
function App() { const [day, setDay] = React.useState<DayValue>(null); const [dayRange, setDayRange] = React.useState<DayRange>({ from: null, to: null }); const [days, setDays] = React.useState<Day[]>([]);
return (
<>
<DatePicker value={day} onChange={setDay} />
<DatePicker value={dayRange} onChange={setDayRange} />
<DatePicker value={days} onChange={setDays} />
</>
);
}
export default App
Reproduced Version on CodeSandbox Here it is on CodeSandBox: Link
Expected behavior A clear and concise description of what you expected to happen.
same bug here !
we cannot remove elements of "react-modern-calendar-datepicker", follow in below the example can be useful for you, finally why?? because the library was old 👎 also I don't see any 'dev/contribute' feedback....
<div display={isOpen ? "block" : "none"}> <Calendar /> </div>
I would definitely suggest you use react-multi-date-picker instead It supports all date formats and any thing you may want
We had same issue in a project. This helped us.
-
Remove react-modern-calendar-datepicker from your dependencies.
-
npm i @hassanmojab/react-modern-calendar-datepicker
-
import everything from @hassanmojab/react-modern-calendar-datepicker instead react-modern-calendar-datepicker
here for detail explanation https://stackoverflow.com/questions/73879703/react-typeerror-cannot-read-properties-of-null-reading-removeeventlistener