fix calendar

This commit is contained in:
Thomas Ruoff
2022-02-20 00:14:54 +01:00
committed by Thomas Ruoff
parent 0d71a41c9a
commit 0aaca45c47

View File

@@ -13,7 +13,7 @@ import { dateFormatBackend } from '../helpers/date'
import { getNextBigger, getNextSmaller } from '../helpers/array' import { getNextBigger, getNextSmaller } from '../helpers/array'
import Loading from './loading' import Loading from './loading'
export default function PlainCalendar({ export default function MyCalendar({
start, start,
end, end,
onChange = null, onChange = null,
@@ -96,7 +96,7 @@ export default function PlainCalendar({
<h2 className="text-xl">Belegungsplan</h2> <h2 className="text-xl">Belegungsplan</h2>
<Loading loading={daysBookedLoading}> <Loading loading={daysBookedLoading}>
<Calendar <Calendar
activeStartDate={startDate} defaultActiveStartDate={startDate}
minDate={new Date()} minDate={new Date()}
// @ts-ignore // @ts-ignore
onClickDay={( onClickDay={(
@@ -120,7 +120,8 @@ export default function PlainCalendar({
return return
} }
if (!startDate || !!endDate) { // when startDate missing or both are already set
if (!startDate || (!!startDate && !!endDate)) {
onChange({ startDate: dateFormatBackend(date), endDate: null }) onChange({ startDate: dateFormatBackend(date), endDate: null })
return return
} }