mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
allow booking today
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user