Hey podcasters! I wrote this little function for a SO question and thought it might be useful to someone else.
It's a quick true/false test to see if your show is on the air!
Let's say I host a show from 2:00-2:30pm Central Time (-6 UTC). Here's how to test that using onAir.js
var isShowing = onAir('Tuesday', '14:00', '14:30', '-6');Now isShowing will be either true or false if our show is currently airing!
A practice use case for this function would be show or hide a <div> on your page if your show is on the air:
$(document).ready(function () {
// test if our show is live
var isShowing = onAir('Tuesday', '14:00', '14:30', '-6');
// show our div if we are!
if (isShowing) {
$('#wearelive').show();
}
});