Created
May 29, 2021 08:08
-
-
Save wendeehsu/32298e7c5cc07e28008e91d7341b6863 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 sendReminder() { | |
console.log(checkDay()); | |
if (checkDay() == false) { // weekend | |
return; | |
} | |
var lastRow = remindSheet.getLastRow(); | |
if (lastRow > 0) { | |
var ids = remindSheet.getSheetValues(1,1,lastRow,1); | |
for(var i = 0; i < lastRow; i++){ | |
pushMsg("嗨嗨打卡了嗎~",ids[i][0]); // "Hi, please remember to punch~" | |
} | |
} | |
} | |
function checkDay() { | |
var day = new Date().toLocaleString("en-US", { | |
timeZone: "Asia/Taipei", | |
}); | |
var dayOfWeek = new Date(day).getDay(); | |
if (dayOfWeek == 0 || dayOfWeek == 6) { | |
return false; | |
} else { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment