Google Calendar Helper
Use Google Calendar API v3 to
- check if a date is holiday
- get holiday names of a given date
with a given list of publicly available calendars
Installation
npm install --save google-calendar-holiday
Set up your credentials and Google Calendar
Enable Google Calendar API https://developers.google.com/calendar/quickstart/nodejs
Create an API key in Credentials page
Examples
Init
const GoolgeCalendarHoliday = ;const holiday = 'API_KEY' hkHoliday: 'zh-tw.hong_kong%23holiday%40group.v.calendar.google.com' usHoliday: 'en.usa%23holiday%40group.v.calendar.google.com' ;// this will try to make an API call to test if the API key is validawait holiday;
Check whether a date is holiday
holiday // trueholiday // true // specify calendarsholiday // trueholiday // false
Get holiday names of a date
holiday // ['重陽節']holiday // ['Thanksgiving Day']holiday // ['元旦', 'New Year's Day'] // specify calendarsholiday // ['重陽節']holiday // ['']