react-modern-calendar-datepicker icon indicating copy to clipboard operation
react-modern-calendar-datepicker copied to clipboard

Simple examples in typescript doesn't work

Open ivose opened this issue 1 year ago • 4 comments

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 image

Reproduced Version on CodeSandbox Here it is on CodeSandBox: Link

Expected behavior A clear and concise description of what you expected to happen.

ivose avatar Mar 01 '23 07:03 ivose

same bug here !

mohammadgarmroodi avatar Mar 04 '23 16:03 mohammadgarmroodi

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>

synasapmob avatar Mar 18 '23 09:03 synasapmob

I would definitely suggest you use react-multi-date-picker instead It supports all date formats and any thing you may want

MohammadAzimi avatar May 11 '23 12:05 MohammadAzimi

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

emrekrt1655 avatar May 12 '23 12:05 emrekrt1655