0.0.8-alpha ā€¢ Published 3 years ago

holidate v0.0.8-alpha

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Welcome to holidate šŸ“…

Version Maintenance License: MIT

JS library for calculating and validating holidays

šŸ  Homepage

Install

npm install holidate

Usage

const holidate = require('holidate');

let holidays = holidate.getHolidays();

Example output

[
    {
        "name": "New Year's Day",
        "tags": [ "federal" ],
        "natural": true,
        "date": "2021-01-01T07:00:00.000Z"
    },
    {
        "name": "Martin Luther King Jr. Day",
        "tags": [ "federal" ],
        "natural": true,
        "date": "2021-01-18T07:00:00.000Z"
    },
    {
        "name": "Washington's Birthday",
        "tags": [ "federal" ],
        "natural": true,
        "date": "2021-02-15T07:00:00.000Z"
    },
    {
        "name": "Memorial Day",
        "tags": [ "federal" ],
        "natural": true,
        "date": "2021-05-31T07:00:00.000Z"
    },
    {
        "name": "Juneteenth National Independence Day (observed)",
        "tags": [ "federal" ],
        "natural": false,
        "date": "2021-06-18T07:00:00.000Z"
    },
    {
        "name": "Juneteenth National Independence Day",
        "tags": [ "federal" ],
        "natural": true,
        "date": "2021-06-19T07:00:00.000Z"
    },
    // ...
]

API

getHolidays(year, country, language)

ParameterTypeDescription
yearnumberThe holidays for this year will be returned. Defaults to the current year.
countrystringThe ISO 3166-1 alpha 2 country code. Defaults to 'US'.
languagestringThe ISO 639-1 language code for the language the holiday names will be returned in. Defaults to 'en'.

Response

Array of holiday objects

Holiday

FieldTypeDescription
namestringName of the holiday.
tagsarray of stringsDescriptors that can be used to filter the holiday list. For example, Easter in the United States has these tags: [ 'non-federal', 'religious', 'christianity' ]
naturalbooleanWhether the holiday object represents the actual holiday date or the date it is being observed in a given year. For example if the holiday falls on a weekend but is observed on a weekday to preserve the work holiday.
dateDateDate of the holiday.

Author

šŸ‘¤ zachnology

šŸ¤ Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ā­ļø if this project helped you!

šŸ“ License

Copyright Ā© 2021 Zack Gomez.

This project is MIT licensed.


This README was generated with ā¤ļø by readme-md-generator

0.0.6-alpha

3 years ago

0.0.8-alpha

3 years ago

0.0.4-alpha

3 years ago

0.0.5-alpha

3 years ago

0.0.3-alpha

3 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago