JSFiddle - React, Tailwind, and code Playground
by Ian Brown
HTML
<script src="http://www.ian-b.com/js/later.js"></script>
<div id="sched">Time? Valid?</div>
JavaScript
// will fire every 5 minutes
//var textSched = later.parse.text('every 1 second');
var sched = {
schedules: [{
dw: [2, 3, 4, 5, 6], //Mon-Fri
h_a: [5],
h_b: [8]
}, {
dw: [2, 3, 4, 5, 6], //Mon-Fri
h_a: [15],
h_b: [22]
}, {
dw: [0, 1], //Sat, Sun
h_a: [8],
h_b: [22]
}]
};
var test = later.schedule(sched);
$('#sched').text(test.isValid(new Date()));
//var timer = later.setInterval(logTime, sched);
// function to execute
function logTime() {
$('#sched').text(new Date());
}
//Day of week 1 for sunday, 0 Saturday
//
// clear the interval timer when you are done
//timer.clear();