fix: disallow selecting dates in the past or today
This commit is contained in:
+3
-2
@@ -50,7 +50,7 @@
|
||||
|
||||
const upcoming = Array.from(availableDatesMap.keys())
|
||||
.map((dateKey) => new Date(`${dateKey}T00:00:00`))
|
||||
.filter((date) => date >= today)
|
||||
.filter((date) => date > today)
|
||||
.sort((a, b) => a - b);
|
||||
|
||||
if (upcoming.length > 0) {
|
||||
@@ -88,7 +88,8 @@
|
||||
button.textContent = String(day);
|
||||
|
||||
const dateInfo = availableDatesMap.get(key);
|
||||
const isAvailable = Boolean(dateInfo);
|
||||
const isPastOrToday = cellDate <= today;
|
||||
const isAvailable = Boolean(dateInfo) && !isPastOrToday;
|
||||
const isToday = cellDate.getTime() === today.getTime();
|
||||
const isSelected = selectedDate && cellDate.getTime() === selectedDate.getTime();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user