allow booking today

This commit is contained in:
Thomas Ruoff
2020-10-10 21:56:52 +02:00
parent ef9a699da6
commit 36226a7fa9

View File

@@ -1,6 +1,12 @@
import React, { useContext } from 'react'
import classnames from 'classnames'
import { isPast, isSameDay, isAfter, isWithinInterval } from 'date-fns'
import {
isPast,
isSameDay,
isAfter,
isWithinInterval,
endOfDay,
} from 'date-fns'
import useSWR from 'swr'
import Calendar from 'react-calendar'
import { dateFormatBackend } from '../../helpers/date'
@@ -42,7 +48,7 @@ export default function MyCalendar({ ...props }) {
function tileClassName({ date, view }) {
const isMonthView = view === 'month'
const isDaysBookedLoaded = !!daysBooked
const isInPast = isPast(date)
const isInPast = isPast(endOfDay(date))
const isBooked = daysBooked?.includes(dateFormatBackend(date))
return classnames({
'react-calendar__tile--past': isMonthView && isInPast,