Error:
Type 'CalendarDate | undefined' is not assignable to type 'DateValue | null | undefined'.
Type 'CalendarDate' is not assignable to type 'DateValue | null | undefined'.
Type 'CalendarDate' is not assignable to type 'ZonedDateTime'.
Property '#private' in type 'CalendarDate' refers to a different member that cannot be accessed from within type 'ZonedDateTime'.
Code
<Controller
control={control}
name={name}
render={({ field: { value, onChange, ...rest } }) => (
<DatePicker
dateInputClassNames={{
base:!w-full border !rounded-lg ${ hasError ? "border-red-500" : "border-gray-300" },
inputWrapper: "bg-transparent",
}}
radius="sm"
{...rest}
value={value ? toCalendarDate(value) : undefined}
onChange={(date: CalendarDate | null) => {
if (date) {
const dateValue = new Date(date.year, date.month - 1, date.day);
onChange(dateValue);
} else {
onChange(null);
}
}}
/>
)}
/>