Socket
Socket
Sign inDemoInstall

holiday-calculator

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    holiday-calculator

Calculates number of holidays between 2 dates.


Version published
Weekly downloads
12
decreased by-83.78%
Maintainers
1
Install size
4.16 MB
Created
Weekly downloads
 

Changelog

Source

0.0.1-beta.4

  • Added MLK day, Presidents Day & Veterans Day to US list

Readme

Source

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]

Keywords

FAQs

Last updated on 27 Nov 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc