Last active
December 2, 2019 19:12
-
-
Save ricardobrg/6486b542f810904f254658799c48d310 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_happening_now(talk) { | |
// take talk.datetime in ms from epoch | |
let talkTime = new Date(talk.datetime).getTime(); | |
// calculate talkend in ms from epoch | |
let talkEnd = talkTime + (talk.duration * 60000); | |
// take current epoch time in browser`s timezone | |
let now = new Date().getTime(); | |
// Return boolean true if talk is happening now or false. | |
return now > talkTime && now < talkEnd; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment