JSFiddle - React, Tailwind, and code Playground

by serebrov

HTML

<p>Enter Time to start dashboard</p>
<p>Hour</p>
<input id="strthour">
<p>Minute</p>
<input id="strtmin">
<button onclick="setTime()">Submit</button>

JavaScript

var hr = 06;
var mn = 00;

window.setTime = function() {
  alert(strthour);
  hr = strthour.value;
  mn = strtmin.value;
  //alert(hr + mn);
}

window.setInterval(function(){ // Set interval for checking

    //debugger;
    var date = new Date(); // Create a Date object to find out what time it is
    //alert(hr + mn + '-'+date.getHours() + date.getMinutes() + date.getSeconds());
    // Check the time
    if(date.getHours() == hr && date.getMinutes() == mn && date.getSeconds() == 0){
        alert("it worked")
    }
}, 10000); // Repeat every 60000 milliseconds (1 minute)