compare UTC date

PHOTO EMBED

Wed Mar 02 2022 15:54:31 GMT+0000 (Coordinated Universal Time)

Saved by @mmerkley #html

var x = setInterval(function() {
  var d = new Date();
  var gmtTime = d.toUTCString();
  var gmtCompare = d.toISOString(gmtTime);

  // var eventDate = new Date('March 01, 2022, 16:44:00 GMT-07:00').toUTCString(); // Mountain Standard Time
  var eventDate = new Date('March 23, 2022, 12:00:00 GMT+05:30').toUTCString(); // India Standard Time
  var compareString = new Date(eventDate).toISOString();
  console.log(gmtCompare, compareString);

  if(gmtCompare >= compareString) {
    alert('event is done');
    clearInterval(x);
  }
}, 1000);
content_copyCOPY