fix bug and check day of week

master
Spencer Churchill 2022-09-22 23:46:27 -07:00
parent 9f16ca2183
commit 085b58084c
2 changed files with 6 additions and 3 deletions

View File

@ -1,3 +1,3 @@
0.01: New Widget!
0.02: Fix calling null on draw
0.03: Only vibrate during working hours
0.03: Only vibrate during work

View File

@ -7,8 +7,11 @@ they don't interfere with currently-running apps */
const look = 20 * 1000; // 20 seconds
buzz = _ => {
const d = new Date();
if (d >= 8 && d <= 17) { // run from 8 AM - 5 PM
const date = new Date();
const day = date.getDay();
const hour = date.getHours();
// buzz at work
if (day <= 5 && hour >= 8 && hour <= 17) {
Bangle.buzz().then(_ => {
setTimeout(Bangle.buzz, look);
});