diff --git a/src/components/DatePicker/DatePicker.jsx b/src/components/DatePicker/DatePicker.jsx index 0dd426ba7..59fb0b8b3 100644 --- a/src/components/DatePicker/DatePicker.jsx +++ b/src/components/DatePicker/DatePicker.jsx @@ -141,6 +141,8 @@ export const DatePicker = ({ // Comparing `from` and `to` dates hides a weird CSS style when you select the same date twice in a date range. const useDateRangeStyle = isRangeVariant && value.from?.getTime() !== value.to?.getTime(); + // Return the same value if it is already dayjs object or has range variant otherwise format it to dayJs object + const selectedDays = dayjs.isDayjs(value) || isRangeVariant ? value : dayjs(value).toDate(); return ( <> @@ -189,7 +191,7 @@ export const DatePicker = ({ modifiers.waitlist ? "has-custom-content" : null, )} todayButton={variant === "single" ? "Today" : undefined} - selectedDays={value} + selectedDays={selectedDays} month={currentMonth} modifiers={{ ...modifiers, ...rangeModifier }} numberOfMonths={isRangeVariant ? 2 : 1}