diff --git a/components/ui/datetime-picker.tsx b/components/ui/datetime-picker.tsx index 62ffdb5..787c8a5 100644 --- a/components/ui/datetime-picker.tsx +++ b/components/ui/datetime-picker.tsx @@ -248,6 +248,28 @@ function Calendar({ }, []); const YEARS = React.useMemo(() => genYears(yearRange), []); + const disableLeftNavigation = () => { + const today = new Date(); + const startDate = new Date(today.getFullYear() - yearRange, 0, 1); + if (props.month) { + return ( + props.month.getMonth() === startDate.getMonth() && + props.month.getFullYear() === startDate.getFullYear() + ); + } + return false; + }; + const disableRightNavigation = () => { + const today = new Date(); + const endDate = new Date(today.getFullYear() + yearRange, 11, 31); + if (props.month) { + return ( + props.month.getMonth() === endDate.getMonth() && + props.month.getFullYear() === endDate.getFullYear() + ); + } + return false; + }; return (