Improve logging

This commit is contained in:
Maks Snegov 2024-04-14 21:51:19 -07:00
parent 8b14b4b2e4
commit e7d22d78a3

View File

@ -14,6 +14,9 @@ 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;"]');
@ -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);
}