https://github.com/mitica/public-holidays-js
Public holidays by country. Readonly from google calendar. Nodejs module.
https://github.com/mitica/public-holidays-js
google-calendar holiday holidays nodejs
Last synced: 5 months ago
JSON representation
Public holidays by country. Readonly from google calendar. Nodejs module.
- Host: GitHub
- URL: https://github.com/mitica/public-holidays-js
- Owner: mitica
- Created: 2016-11-09T07:16:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-10-10T02:08:57.000Z (about 2 years ago)
- Last Synced: 2025-04-12T23:51:25.706Z (7 months ago)
- Topics: google-calendar, holiday, holidays, nodejs
- Language: TypeScript
- Size: 847 KB
- Stars: 19
- Watchers: 1
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# public-holidays
Gets public holidays from google calendar.
## Usage
```ts
import { getHolidays } from 'public-holidays';
// public holidays for US in English
const options = { country: 'us', lang: 'en' };
const holidays = await getHolidays(options);
```
## API (v0.2)
### formatCalendarUrl(country, lang): string
Format google calendar url by country and language.
### getHolidays(options): Promise
Get public holidays by options.
#### options:
- **country** (string) (required) - country 2 letters code: `us`, `ru`
- **lang** (string) (required) - language 2 letters code: `en`, `ru`
- **start** (Date) (optional) - start date
- **end** (Date) (optional) - end date
- **timeout** (number) (optional) - request timeout in ms
#### types:
```ts
type Holiday = {
date: Date
name: string
}
type Options = {
country: string
lang: string
start?: Date
end?: Date
timeout?: number
}
```