Add debugging

This commit is contained in:
Brandon Keepers
2017-09-15 17:18:20 -05:00
parent c347f7d849
commit ca15a88fa6

View File

@@ -1,29 +1,27 @@
// Calculate the next Office Hours
// Change to true to show nags
var debug = false;
// Adjust to Friday at 17:00 UTC / 1pm Eastern
var attrs = {day: "Friday", hour: 17, minute: 0, second: 0, millisecond: 0}
var start = moment().utc().set(attrs)
var start = moment().utc().set(attrs).local()
// If it's already passed today, go to next Friday
if(start < moment().utc()) {
if(start < moment()) {
start.add({days: 7})
}
end = moment(start).add({hour: 1})
if(start < moment().add(4, 'hours')) {
if(debug || start < moment().add(4, 'hours')) {
document.body.classList.add('office-hours-soon')
document.querySelectorAll('.office-hours-nag').forEach(function(el) {
el.classList.remove('d-none')
});
}
// Switch back to local time
start.local();
end.local();
displayTime(document.querySelectorAll('.js-office-hours-start-time'), start);
displayTime(document.querySelectorAll('.js-office-hours-end-time'), end);