0.0.1-beta.4 • Published 6 years ago

holiday-calculator v0.0.1-beta.4

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

holiday-calculator

npm-version Build Status dependencies dev dependencies peer dependencies

Holiday utilities for Moment. Not a plugin though. 😒

Installation

node

npm install holiday-calculator

API

countBusinessHolidaysBetween(startDate: Moment | string, endDate: Moment | string)

Returns the number of holidays observed by businesses between startDate and endDate.

import {US} from 'holiday-calculator';

new US().countBusinessHolidaysBetween('2017-01-01', '2017-12-31'); // => 6

Holiday Rules

All the rules for determining holidays is encapsulated in a Holidays object. US is currently the only one that's builtin. It recognizes:

  1. New Years Day
  2. Martin Luther King Jr. Day
  3. Presidents' Day
  4. Memorial Day
  5. Independence Day
  6. Labor Day
  7. Veterans Day
  8. Thanksgiving
  9. Christmas Day

Development

git clone https://github.com/darrinholst/moment-holiday
cd moment-holiday
npm i
npm test

Release

release-it [semver]