From 36226a7fa95936ea5eee9465722a89ade08a158e Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Sat, 10 Oct 2020 21:56:52 +0200 Subject: [PATCH] allow booking today --- components/wizard/calendar.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/wizard/calendar.tsx b/components/wizard/calendar.tsx index 94f5cd3..435138a 100644 --- a/components/wizard/calendar.tsx +++ b/components/wizard/calendar.tsx @@ -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,