nz-public-holidays
v1.3.0
Published
Gets New Zealand public holiday details from a government .ical
Downloads
6
Maintainers
Readme
Produces dates and details for New Zealand public holidays. Uses this government .iCal as source. If this changes, please raise an issue.
Install
npm install nz-public-holidays
Usage
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}'`;
}));
})();
Response Schema
| 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 |
Regions
Northland, Auckland, Taranaki, Hawke's Bay, Wellington, Marlborough, Nelson, Buller, South Canterbury, Canterbury, Westland, Otago, Southland, Chatham Islands, All
Categories
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)
Author
Tomas van der Wel
- Github: @Tomasvanderwel
License
Copyright © 2019 Tomas van der Wel. This project is MIT licensed.