diff --git a/packages/features/bookings/Booker/components/Header.tsx b/packages/features/bookings/Booker/components/Header.tsx index 3b380e6c8f..9ac23eff02 100644 --- a/packages/features/bookings/Booker/components/Header.tsx +++ b/packages/features/bookings/Booker/components/Header.tsx @@ -57,13 +57,33 @@ export function Header({ return ; } + const endDate = selectedDate.add(extraDays, "days"); + + const isSameMonth = () => { + return selectedDate.format("MMM") === endDate.format("MMM"); + }; + + const isSameYear = () => { + return selectedDate.format("YYYY") === endDate.format("YYYY"); + }; + + const FormattedSelectedDateRange = () => { + return ( +

+ {selectedDate.format("MMM D")} + {!isSameYear() && , {selectedDate.format("YYYY")} }-{" "} + {isSameMonth() ? endDate.format("D") : endDate.format("MMM D")},{" "} + + {isSameYear() ? selectedDate.format("YYYY") : endDate.format("YYYY")} + +

+ ); + }; + return (
-

- {selectedDate.format("MMM D")}-{selectedDate.add(extraDays, "days").format("D")},{" "} - {selectedDate.format("YYYY")} -

+