Skip to content

Commit

Permalink
chore: Simplify date validation logic in DatePickerWidget2 by removin…
Browse files Browse the repository at this point in the history
…g unnecessary timePrecision checks for min/max dates
  • Loading branch information
rahulbarwal committed Nov 6, 2024
1 parent d04d103 commit 306373a
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions app/client/src/widgets/DatePickerWidget2/widget/derived.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,11 @@ export default {
}

if (minDate) {
if (props.timePrecision === "None") {
return selectedDate.isSameOrAfter(minDate, granularity);
}

return selectedDate.isSame(minDate, granularity);
return selectedDate.isSameOrAfter(minDate, granularity);
}

if (maxDate) {
if (props.timePrecision === "None") {
return selectedDate.isSameOrBefore(maxDate, granularity);
}

return selectedDate.isBefore(maxDate, granularity);
return selectedDate.isSameOrBefore(maxDate, granularity);
}

return true;
Expand Down

0 comments on commit 306373a

Please sign in to comment.