Skip to content

Commit

Permalink
fix: update connector to avoid invalid date error after pattern drop
Browse files Browse the repository at this point in the history
Close #27
  • Loading branch information
paodb committed Jul 19, 2024
1 parent 9f49633 commit ada0a4c
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ window.Vaadin.Flow.enhancedDateRangePickerConnector = {
return cleanString(rawDate.toLocaleDateString(locale));
};

let cachedObject;

const parseDateBasedOnParsers = function (dateString, parsersCopy, language) {
var date;
var i;
Expand All @@ -110,11 +112,15 @@ window.Vaadin.Flow.enhancedDateRangePickerConnector = {
} catch (err) {}
}

return {
day: date.getDate(),
month: date.getMonth(),
year: date.getFullYear(),
};
if (date != 'Invalid Date') {
cachedObject = {
day: date.getDate(),
month: date.getMonth(),
year: date.getFullYear(),
}
}

return cachedObject;
};

const parseDateBasedOnLocale = function (dateString) {
Expand Down

0 comments on commit ada0a4c

Please sign in to comment.