danielmoncada / date-time-picker

Angular Date Time Picker (Responsive Design)
https://daniel-projects.firebaseapp.com/owlng/date-time-picker
MIT License
140 stars 60 forks source link

Unable to select the configured minDate when using pickerType="calendar" #114

Closed Laurensvdw closed 2 years ago

Laurensvdw commented 3 years ago

Hi!

First of all, thank you for the fork and maintaining this library!

When we configure a minDate, e.g. new Date(), we are unable to select the configured date. Let's say for example we set minDate to 29 March 2021. Then we can't select that specific day in the calendar, only the days that follow up, like 30 March... Important, this is only the case when using pickerType="calendar".

Expected behavior is that we are able to select the minDate, it should include the set date.

SOLUTION: ignore time when pickerType is set to calendar, now it includes time so for example new Date() as minDate sets it to be minimum 29 march 2021 16:29, while selecting a date with pickerType="calendar" it selects 29 march 2021 00:00, which is invalid as it is before the exact minDate (being 29 march 2021 16:29 in this example)...

We can go around this problem by always calling .setHours(0,0,0,0) on the date we want as minDate.

Thanks for looking into it!

Greetings, Laurens

danielmoncada commented 2 years ago

solution provided in original comment. closing