Merge pull request #212 from probot/fix-office-hours-nag

Advance to next week if start is past
This commit is contained in:
Brandon Keepers
2018-07-12 16:10:17 -05:00
committed by GitHub

View File

@@ -5,10 +5,14 @@ var debug = false;
// Adjust to Thursday at 17:00 UTC / 1pm EDT
var attrs = {day: "Thursday", hour: 17, minute: 0, second: 0, millisecond: 0}
var start = moment().utc().set(attrs)
var end = start.clone().add({hour: 1})
// If it's already passed today, go to the next occurrence
if(start < moment()) {
start.add({days: 7})
}
var end = start.clone().add({hour: 1})
if(debug || start < moment().utc().add(4, 'hours')) {
document.body.classList.add('office-hours-soon')