Produces dates and details for New Zealand public holidays. Uses this government .iCal as source. If this changes, please raise an issue.
npm install nz-public-holidays
const holidays = require('nz-public-holidays');
holidays((error, holidays) => {
if (error) return console.error(error);
console.log(...holidays.map((holiday) => {
const { date, name, region, category, observedByWeekendWorker } = holiday;
return `UPDATE tablename SET [HolidayName] = '${category}'` +
`, [IsHoliday] = 1 WHERE [Date] = '${date}'`;
}));
});
// OR
(async () => {
const holidays = await holidays();
console.log(...holidays.map((holiday) => {
const { date, name, region, category, observedByWeekendWorker } = holiday;
return `UPDATE tablename SET [HolidayName] = '${category}'` +
`, [IsHoliday] = 1 WHERE [Date] = '${date}'`;
}));
})();
Column name | Type | Description |
---|---|---|
date | string | Date of holiday YYYY-MM-DD |
name | string | Raw name of holiday |
region | string | Name of applicable region |
category | string | Standardised name of holiday |
observedByWeekendWorker | boolean | If holiday is observed exclusively by weekend workers |
Northland, Auckland, Taranaki, Hawke's Bay, Wellington, Marlborough, Nelson, Buller, South Canterbury, Canterbury, Westland, Otago, Southland, Chatham Islands, All
New Year's Day, Day after New Year's Day, Waitangi Day, Good Friday, Easter Monday, ANZAC Day, Queen's Birthday, Labour Day, Christmas Day, Boxing Day, Anniversary (Region)
Tomas van der Wel
- Github: @Tomasvanderwel
Copyright © 2019 Tomas van der Wel.
This project is MIT licensed.