emm - use string instead of date for start/endDate

This commit is contained in:
Thomas Ruoff
2022-03-30 23:56:08 +02:00
parent 9f45eab6e7
commit c65d8df853
8 changed files with 13652 additions and 878 deletions

View File

@@ -107,6 +107,8 @@ export default function MyCalendar({
return
}
const dateAsBackendFormat = dateFormatBackend(date);
event.preventDefault()
event.stopPropagation()
@@ -122,15 +124,15 @@ export default function MyCalendar({
// when startDate missing or both are already set
if (!startDate || (!!startDate && !!endDate)) {
onChange({ startDate: date, endDate: null })
onChange({ startDate: dateAsBackendFormat, endDate: null })
return
}
// when startDate set, but end missing
if (isAfter(date, startDate)) {
onChange({ endDate: date })
onChange({ endDate: dateAsBackendFormat })
} else {
onChange({ startDate: date, endDate: date })
onChange({ startDate: dateAsBackendFormat, endDate: dateAsBackendFormat })
}
}}
tileClassName={tileClassName}