// Get the current date and add 2 days
const today = new Date();
today.setHours(0, 0, 0, 0); // Set to the beginning of the day
const datePlusTwo = new Date(today);
datePlusTwo.setDate(datePlusTwo.getDate() + 2);
// Function to parse the date from the format 'Tuesday, August 20, 2024'
function parseDate(dateString) {
return new Date(dateString.replace(/^/w+, /, '')); // Remove the day name and parse the rest
}
// Select all
elements containing the date
const tds = document.querySelectorAll('td');
// Iterate over the
elements
tds.forEach(td => {
const tdDateText = td.textContent.trim();
const tdDate = parseDate(tdDateText);
// Compare the td date with today's date + 2
if (tdDate < datePlusTwo) {
td.classList.add('rcOutOfRange');
}
});