Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: error thrown and calendar UI broken by invalid input value when allowInput is true and allowInvalidPreload is true #2650

Merged
merged 1 commit into from Mar 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/index.ts
Expand Up @@ -326,7 +326,7 @@ function FlatpickrInstance(
function setHoursFromDate(dateObj?: Date) {
const date = dateObj || self.latestSelectedDateObj;

if (date) {
if (date && date instanceof Date) {
setHours(date.getHours(), date.getMinutes(), date.getSeconds());
}
}
Expand Down Expand Up @@ -2758,7 +2758,8 @@ function FlatpickrInstance(

function isDateSelected(date: Date) {
for (let i = 0; i < self.selectedDates.length; i++) {
if (compareDates(self.selectedDates[i], date) === 0) return "" + i;
const selectedDate = self.selectedDates[i];
if (selectedDate instanceof Date && compareDates(selectedDate, date) === 0) return "" + i;
}

return false;
Expand Down