Skip to content

Commit

Permalink
fix: show correct date in picker input
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordy Quak committed Jan 29, 2024
1 parent 4616897 commit 001fa20
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/dateTimePickerInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@
switch (type) {
case 'date': {
const formattedDate = DateFns.parse(parsedValue, dateFormat);
setSelectedDate(formattedDate);

if (isValidDate(formattedDate)) {
setSelectedDate(formattedDate);
} else {
setSelectedDate(new Date(parsedValue.replace(/-/g, '/')));
}
break;
}

Expand Down

0 comments on commit 001fa20

Please sign in to comment.