From e7d22d78a32ea8758f99e3984ce45cf73673b987 Mon Sep 17 00:00:00 2001 From: Maks Snegov Date: Sun, 14 Apr 2024 21:51:19 -0700 Subject: [PATCH] Improve logging --- content.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); }