diff --git a/content.js b/content.js index 41841cb..433e643 100644 --- a/content.js +++ b/content.js @@ -14,7 +14,10 @@ function sendPostRequest(data) { function checkDate() { const targetElement = document.querySelector('.swal2-html-container'); - + // Get current time + const currentTime = new Date(); + const formattedTime = currentTime.toISOString(); + if (targetElement) { const availabilitySpan = targetElement.querySelector('span[style="color: lightgreen;"]'); const appointmentSpan = targetElement.querySelector('span[style="color: orange"]'); @@ -25,9 +28,10 @@ function checkDate() { if (date_avail && date_booked) { const date_avail_date = new Date(date_avail); const date_booked_date = new Date(date_booked); + console.log(`${formattedTime}: available date ${date_avail}; booked on ${date_booked}`); // Compare the dates - if (date_avail_date < date_booked_date) { + if (date_avail_date > date_booked_date) { const message = `available date ${date_avail}; booked on ${date_booked}`; sendPostRequest(message); }