shahabyazdi / react-multi-date-picker

a simple React datepicker component for working with gregorian, persian, arabic and indian calendars
https://shahabyazdi.github.io/react-multi-date-picker/
MIT License
766 stars 90 forks source link

last day of maxDate can not be selected at 4.4.1 version! #256

Open Amirhossein-Ghasemzadeh opened 7 months ago

Amirhossein-Ghasemzadeh commented 7 months ago

you can check it here: https://codesandbox.io/s/react-multi-date-picker-forked-8szhdq

olfatgh commented 3 months ago

same issue here, and if passed the last minute of maxDate which is 23:59, it will be selectable but it sets the value immediately on opening the calendar.

handzlikt commented 1 month ago

Same here on 4.5.1. Minimal setup https://codesandbox.io/p/sandbox/recat-multi-62xs7c When you select the last date and then some other dates they'll all disappear after closing the calendar.

info2programmer commented 6 days ago

Any solution here?

handzlikt commented 6 days ago

@info2programmer after looking into the implementation of this library I've figured out there is an issue with initializing the DateObject. It uses current time which later fails when comparing dates. As as a workaround I'm passing DateObject initialized with a time (beginning of a day or end of a day):

minDate={
        new DateObject({
          date: '06/02/2024 00:00:01',
          format: 'MM/DD/YYYY HH:mm:ss,
        })
}
maxDate={
        new DateObject({
          date: '07/02/2024 23:59:59',
          format: 'MM/DD/YYYY HH:mm:ss',
        })
}