fix: date and month format issue on booking page for weekly view (#10512)
Co-authored-by: Raghul D <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
1 file changed
+24
-4
@@ -57,13 +57,33 @@ export function Header({
|
||||
return <LayoutToggleWithData />;
|
||||
}
|
||||
|
||||
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 (
|
||||
<h3 className="min-w-[150px] text-base font-semibold leading-4">
|
||||
{selectedDate.format("MMM D")}
|
||||
{!isSameYear() && <span className="text-subtle">, {selectedDate.format("YYYY")} </span>}-{" "}
|
||||
{isSameMonth() ? endDate.format("D") : endDate.format("MMM D")},{" "}
|
||||
<span className="text-subtle">
|
||||
{isSameYear() ? selectedDate.format("YYYY") : endDate.format("YYYY")}
|
||||
</span>
|
||||
</h3>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="border-default relative z-10 flex border-b border-l px-5 py-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<h3 className="min-w-[150px] text-base font-semibold leading-4">
|
||||
{selectedDate.format("MMM D")}-{selectedDate.add(extraDays, "days").format("D")},{" "}
|
||||
<span className="text-subtle">{selectedDate.format("YYYY")}</span>
|
||||
</h3>
|
||||
<FormattedSelectedDateRange />
|
||||
<ButtonGroup>
|
||||
<Button
|
||||
variant="icon"
|
||||
|
||||
Reference in new issue
Block a user