feat: future day grey.
This commit is contained in:
@@ -123,6 +123,11 @@ export default class CalendarView {
|
||||
dayEl.classList.add('other-month');
|
||||
}
|
||||
|
||||
// Check if the day is in the future
|
||||
if (this.isFutureDate(date)) {
|
||||
dayEl.classList.add('future-day');
|
||||
}
|
||||
|
||||
if (this.isToday(date)) {
|
||||
dayEl.classList.add('today');
|
||||
}
|
||||
@@ -235,6 +240,15 @@ export default class CalendarView {
|
||||
date.getDate() === today.getDate();
|
||||
}
|
||||
|
||||
// Check if a date is in the future
|
||||
isFutureDate(date) {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const checkDate = new Date(date);
|
||||
checkDate.setHours(0, 0, 0, 0);
|
||||
return checkDate > today;
|
||||
}
|
||||
|
||||
formatDate(date) {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
|
||||
Reference in New Issue
Block a user