Skip to content

Commit 8d508b1

Browse files
committed
fix(Calendar, DatePicker, DateRangePicker): the incorrect date is set when the chosen date falls outside of the available range
1 parent 1f7d10e commit 8d508b1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

js/src/util/calendar.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,10 @@ export const removeTimeFromDate = date => {
646646
* @returns {Date} A new Date instance with the date from `target` and time from `source`.
647647
*/
648648
export const setTimeFromDate = (target, source) => {
649+
if (target === null) {
650+
return null
651+
}
652+
649653
if (!(source instanceof Date)) {
650654
return target
651655
}

0 commit comments

Comments
 (0)