Skip to content

Tomasvanderwel/nz-public-holiday

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to nz-public-holidays

Documentation Maintenance License: MIT

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

License

Copyright © 2019 Tomas van der Wel.
This project is MIT licensed.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published