npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nz-holidays

v1.0.1

Published

Lightweight New Zealand public holidays library

Readme

nz-holidays

A lightweight, zero-dependency library for New Zealand public holidays.

Installation

npm install nz-holidays

Quick Start

import { isHoliday, getHolidays, getNextHoliday } from 'nz-holidays';

// Check if today is a holiday
const today = new Date();
console.log(isHoliday(today)); // true/false

// Get all holidays for 2024
const holidays2024 = getHolidays(2024);
console.log(holidays2024);

// Get the next upcoming holiday
const nextHoliday = getNextHoliday();
console.log(`Next holiday: ${nextHoliday.name} on ${nextHoliday.date}`);

API Reference

getHolidays(year, options?)

Returns all holidays for a given year.

const holidays = getHolidays(2024, {
  includeObserved: true,  // Include observed dates for weekend holidays
  region: 'auckland'      // Include regional holidays
});

Options:

  • includeObserved: Include observed dates when holidays fall on weekends (default: true)
  • region: Include regional anniversary days:
    • 'auckland' - Auckland Anniversary Day
    • 'wellington' - Wellington Anniversary Day
    • 'canterbury' - Canterbury Anniversary Day
    • 'otago' - Otago Anniversary Day
    • 'southland' - Southland Anniversary Day
    • 'westland' - Westland Anniversary Day
    • 'nelson' - Nelson Anniversary Day
    • 'marlborough' - Marlborough Anniversary Day
    • 'taranaki' - Taranaki Anniversary Day
    • 'hawkes-bay' - Hawke's Bay Anniversary Day
    • 'south-canterbury' - South Canterbury Anniversary Day
    • 'chatham-islands' - Chatham Islands Anniversary Day

isHoliday(date: Date, options?: HolidayOptions): boolean

Check if a specific date is a holiday.

const christmas = new Date(2024, 11, 25);
console.log(isHoliday(christmas)); // true

// Include regional holidays
console.log(isHoliday(date, { region: 'auckland' }));

getNextHoliday(from?: Date, options?: HolidayOptions): Holiday | null

Get the next upcoming holiday from a given date (defaults to today).

const next = getNextHoliday();
const nextFromDate = getNextHoliday(new Date(2024, 6, 1));

isBusinessDay(date: Date, options?: HolidayOptions): boolean

Check if a date is a business day (not weekend or holiday).

const monday = new Date(2024, 5, 17);
console.log(isBusinessDay(monday)); // true (if not a holiday)

countBusinessDays(start: Date, end, options?): number

Count the number of business days between two dates exclusive

const start = new Date()
const end = new Date(2025, 11, 25);
console.log(countBusinessDays(start, end)); // how long til xmas?

Supported Holidays

National Holidays

  • New Year's Day (1 January)
  • Day after New Year's Day (2 January)
  • Waitangi Day (6 February)
  • Good Friday (Easter-based)
  • Easter Monday (Easter-based)
  • ANZAC Day (25 April)
  • Matariki (Mid-winter, became holiday in 2022)
  • King's Birthday (First Monday in June) *
  • Labour Day (Fourth Monday in October)
  • Christmas Day (25 December)
  • Boxing Day (26 December)

*Called "Queen's Birthday" before 2023

Regional Holidays (Anniversary Days)

  • Auckland - Monday closest to 29 January
  • Wellington - Monday closest to 22 January
  • Canterbury - Second Friday after first Tuesday in November
  • Otago - Monday closest to 23 March
  • Southland - Easter Tuesday (day after Easter Monday)
  • Westland - Monday closest to 1 December
  • Nelson - Monday closest to 1 February
  • Marlborough - First Monday after Labour Day
  • Taranaki - Second Monday in March
  • Hawke's Bay - Friday before Labour Day
  • South Canterbury - Fourth Monday in September
  • Chatham Islands - Monday closest to 30 November

Note: Each region observes only their own anniversary day plus the national holidays.

Features

Mondayisation

When holidays fall on weekends, they're automatically "mondayised" (observed on Monday) according to NZ law.

Special Case - Consecutive Holidays: When Christmas Day and Boxing Day (or New Year's Day and Day After New Year's Day) both fall on weekends:

  • If the first holiday moves to Monday, the second holiday moves to Tuesday
  • This prevents both holidays from being observed on the same day

Example: Christmas 2022 (Sunday) → observed Monday, Boxing Day 2022 (Monday) → observed Tuesday

TypeScript Support

Full TypeScript definitions included:

interface Holiday {
  name: string;
  date: Date;
  type: 'national' | 'regional';
  observed?: Date;
}

interface HolidayOptions {
  includeObserved?: boolean;
  region?: 'auckland' 
  | 'wellington' 
  | 'canterbury' 
  | 'otago' 
  | 'southland' 
  | 'westland' 
  | 'nelson' 
  | 'marlborough' 
  | 'taranaki' 
  | 'hawkes-bay' 
  | 'south-canterbury' 
  | 'chatham-islands';
}