diff --git a/geneit_app/src/dialogs/accommodations/UpdateReservationDialog.tsx b/geneit_app/src/dialogs/accommodations/UpdateReservationDialog.tsx index 7a480e9..362d608 100644 --- a/geneit_app/src/dialogs/accommodations/UpdateReservationDialog.tsx +++ b/geneit_app/src/dialogs/accommodations/UpdateReservationDialog.tsx @@ -78,6 +78,7 @@ export function UpdateReservationDialog(p: { return { ...r!, start: s ?? -1 }; }); }} + minDate={Math.floor(new Date().getTime() / 1000) - 3600 * 24 * 60} /> - {/* Constraint start and end */} - {/* TODO : la suite */} diff --git a/geneit_app/src/widgets/forms/PropDateInput.tsx b/geneit_app/src/widgets/forms/PropDateInput.tsx index 6c50f07..732afbe 100644 --- a/geneit_app/src/widgets/forms/PropDateInput.tsx +++ b/geneit_app/src/widgets/forms/PropDateInput.tsx @@ -12,6 +12,8 @@ export function PropDateInput(p: { value: number | undefined; onChange: (v: number | undefined) => void; lastSecOfDay?: boolean; + minDate?: number; + maxDate?: number; }): React.ReactElement { let shiftV = p.value; if (shiftV && p.lastSecOfDay) { @@ -33,6 +35,9 @@ export function PropDateInput(p: { shiftV && p.value! > 0 ? new Date(shiftV * 1000) : undefined ); + const minDate = p.minDate ? dayjs(new Date(p.minDate * 1000)) : undefined; + const maxDate = p.maxDate ? dayjs(new Date(p.maxDate * 1000)) : undefined; + return (
@@ -47,6 +52,8 @@ export function PropDateInput(p: { } p.onChange?.(v ? v.unix() : undefined); }} + minDate={minDate} + maxDate={maxDate} />