Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darrinholst/holiday-calculator
https://github.com/darrinholst/holiday-calculator
date holiday holiday-calculation moment momentjs
Last synced: about 22 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/darrinholst/holiday-calculator
- Owner: darrinholst
- License: mit
- Created: 2017-06-23T00:49:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-27T19:47:49.000Z (about 7 years ago)
- Last Synced: 2024-12-22T19:39:57.754Z (11 days ago)
- Topics: date, holiday, holiday-calculation, moment, momentjs
- Language: TypeScript
- Size: 30.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# holiday-calculator
[![npm-version](https://img.shields.io/npm/v/holiday-calculator.svg)](https://www.npmjs.com/package/holiday-calculator)
[![Build Status](https://travis-ci.org/darrinholst/holiday-calculator.svg?branch=master)](https://travis-ci.org/darrinholst/holiday-calculator)
[![dependencies](https://david-dm.org/darrinholst/holiday-calculator/status.svg)](https://david-dm.org/darrinholst/holiday-calculator)
[![dev dependencies](https://david-dm.org/darrinholst/holiday-calculator/dev-status.svg)](https://david-dm.org/darrinholst/holiday-calculator?type=dev)
[![peer dependencies](https://david-dm.org/darrinholst/holiday-calculator/peer-status.svg)](https://david-dm.org/darrinholst/holiday-calculator?type=peer)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`.
``` js
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
1. Martin Luther King Jr. Day
1. Presidents' Day
1. Memorial Day
1. Independence Day
1. Labor Day
1. Veterans Day
1. Thanksgiving
1. Christmas Day### Development
git clone https://github.com/darrinholst/moment-holiday
cd moment-holiday
npm i
npm test### Release
release-it [semver]