Skip to content

Instantly share code, notes, and snippets.

@wendeehsu
Created May 29, 2021 08:08
Show Gist options
  • Save wendeehsu/32298e7c5cc07e28008e91d7341b6863 to your computer and use it in GitHub Desktop.
Save wendeehsu/32298e7c5cc07e28008e91d7341b6863 to your computer and use it in GitHub Desktop.
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