Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
improved comment
Browse files Browse the repository at this point in the history
  • Loading branch information
qubis741 committed Nov 21, 2022
1 parent 390151a commit e8b97f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/datepicker/DatePickerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ function DatePickerInput<IsTypeable extends boolean = true>({
if (!preselectedDate) {
handleInputValueChange('');
setSelectedDate(undefined);
// If preseleced invalid date happens when typed date is invalid and value is passed from form in codebase
/*
** Preselected date can be invalid (or string), when typed date is invalid and it's value is passed in prop. For that case
** we need to check it here and set selectedDate and inputValue accordingly
*/
} else if (isValidDate(preselectedDate)) {
handleInputValueChange(getFormattedDateString(preselectedDate));
setSelectedDate(preselectedDate);
Expand Down

0 comments on commit e8b97f3

Please sign in to comment.