Skip to content

Instantly share code, notes, and snippets.

@nyawach
Created April 21, 2020 10:57
Show Gist options
  • Save nyawach/f1b5487c19c0be96a027bedfb710d537 to your computer and use it in GitHub Desktop.
Save nyawach/f1b5487c19c0be96a027bedfb710d537 to your computer and use it in GitHub Desktop.
/**
* @return {Boolean} 祝日かどうか
*/
function isJapaneseHoliday() {
var startDate = new Date();
startDate.setHours(0, 0, 0, 0);
var endDate = new Date();
endDate.setHours(23, 59, 59, 999);
// google calenderの提供している祝日カレンダーを取得する
var cal = CalendarApp.getCalendarById("ja.japanese#holiday@group.v.calendar.google.com");
var holidays = cal.getEvents(startDate, endDate);
return holidays.length !== 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment