) => void
+ min?: Date
+ max?: Date
}
diff --git a/src/calendar.js b/src/calendar.js
index 170f86c..4056f93 100644
--- a/src/calendar.js
+++ b/src/calendar.js
@@ -25,6 +25,8 @@ export function Calendar({
weekdayFormat = 'narrow',
arrowLeft: ArrowLeft = () => <><>,
arrowRight: ArrowRight = () => <>>>,
+ min = undefined,
+ max = undefined,
}) {
const selecting = useRef(false)
const refRange$ = useSignal([])
@@ -199,12 +201,18 @@ export function Calendar({
isRangeEnd && 'preachjs-calendar--grid-cell-end',
]
- if (dateItem.previousMonth || dateItem.nextMonth) {
+ const isDisabled =
+ dateItem.previousMonth ||
+ dateItem.nextMonth ||
+ isOutOfRange(dateItem.date, min, max)
+
+ if (isDisabled) {
return (
| max.getTime()) return true
+ return false
+}
+
function updateDateFromParts(sourceDate, nextValue) {
const nextDate = new Date(sourceDate)
const nextMonth = nextValue.month ?? nextDate.getMonth()
|