Kiarash-Z/react-modern-calendar-datepicker

Simple examples in typescript doesn't work

ivose opened this issue · 4 comments

ivose commented

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(null);
const [dayRange, setDayRange] = React.useState({
from: null,
to: null
});
const [days, setDays] = React.useState<Day[]>([]);

return (
<>



</>
);
}
export default App
image

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