https://github.com/ozzyczech/holidays-cs
Public holidays, Easter, name days and important days in the Czech Republic.
https://github.com/ozzyczech/holidays-cs
czech czech-republic easter easter-date holidays lib library name nameday namedays
Last synced: 4 months ago
JSON representation
Public holidays, Easter, name days and important days in the Czech Republic.
- Host: GitHub
- URL: https://github.com/ozzyczech/holidays-cs
- Owner: OzzyCzech
- License: mit
- Created: 2024-04-08T07:24:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-11-20T09:40:46.000Z (7 months ago)
- Last Synced: 2025-12-11T04:34:44.284Z (6 months ago)
- Topics: czech, czech-republic, easter, easter-date, holidays, lib, library, name, nameday, namedays
- Language: TypeScript
- Homepage: https://ozana.cz
- Size: 489 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Holidays (cs)
[](https://www.npmjs.com/package/holidays-cs)
[](https://www.npmjs.com/package/holidays-cs)
[](https://github.com/OzzyCzech/holidays-cs/blob/main/LICENSE)
[](https://github.com/OzzyCzech/holidays-cs/commits/main)
[](https://github.com/OzzyCzech/holidays-cs/actions)
Public holidays and significant days in the Czech Republic.
## Functions
All functions are available in the main module. You can import them like this:
```javascript
import * as holidays from 'holidays-cs';
```
[Luxon](https://moment.github.io/luxon/) is used for date manipulation.
You can pass a `Date` object or a `DateTime` object to the functions.
Responses are always `DateTime` objects. If you need a `Date` object,
you can use the `response.toJSDate()` method.
## Czech public holidays
```javascript
import {DateTime} from 'luxon';
import {isPublicHoliday, getPublicHoliday} from 'holidays-cs';
// 1. january
isPublicHoliday(DateTime.fromISO('2024-01-01')); // true
// 2. january
isPublicHoliday(DateTime.fromISO('2024-01-02')); // false
// 17. november
isPublicHoliday(DateTime.fromISO('2024-11-17')); // true
getPublicHoliday(DateTime.fromISO('2024-11-17')); // Den boje za svobodu a demokracii (1939 a 1989)
```
You can get all public holidays for a given year:
```javascript
import {getPublicHolidaysList} from 'holidays-cs';
getPublicHolidaysList(2024); // returns Map with all 13 holidays
```
### Shops status
In the Czech Republic, shops are closed on some public holidays.
```javascript
import {DateTime} from 'luxon';
import {areShopsOpen, getShopsStatus} from 'holidays-cs';
// 24. december 2024
areShopsOpen(DateTime.fromISO('2024-12-24')); // true
// 25. december 2024
getShopsStatus(DateTime.fromISO('2024-12-25')); // otevřeno do 12:00
// New Year's Day 2025
areShopsOpen(DateTime.fromISO('2025-01-01')); // false
getShopsStatus(DateTime.fromISO('2025-01-01')); // zavřeno
```
## Czech significant days
Significant days are not public holidays, but they are important in the Czech Republic.
```javascript
import {DateTime} from 'luxon';
import {isSignificantDay, getSignificantDay} from 'holidays-cs';
// 16. jan 2024
isSignificantDay(DateTime.fromISO('2024-01-16')); // true
getSignificantDay(DateTime.fromISO('2024-01-16')).name; // Den památky Jana Palacha
```
Visit the [significant days](https://cs.wikipedia.org/wiki/%C4%8Cesk%C3%BD_st%C3%A1tn%C3%AD_sv%C3%A1tek) page for more information.
## Easter
**Easter Monday** (_Velikonoční pondělí_) and **Good Friday** (_Velký pátek_)
are public holidays in the Czech Republic.
### Easter date
Library can calculate the Easter date for a given year (it's Sunday):
```javascript
import {getEaster} from 'holidays-cs';
getEaster(2024).toISODate(); // 2024-03-31
getEaster(2025).toISODate(); // 2025-04-20
```
Need more? Check out the [Easter Date](https://github.com/OzzyCzech/easter-date) library.
### Easter days
```javascript
import {getGoodFriday, getHolySaturday, getEasterSunday, getEaster, getEasterMonday} from 'holidays-cs';
getGoodFriday(2024).toISODate(); // 2024-03-29
getHolySaturday(2024).toISODate(); // 2024-03-30
// Easter Sunday and Easter are the same
getEasterSunday(2024).toISODate(); // 2024-03-31
getEaster(2024).toISODate(); // 2024-03-31
getEasterMonday(2024).toISODate(); // 2024-04-01
```
You can also check if a given date is Good Friday, Holy Saturday, Easter Sunday or Easter Monday:
```javascript
import {isGoodFriday, isHolySaturday, isEasterSunday, isEasterMonday} from 'holidays-cs';
import {DateTime} from 'luxon';
// 29. march 2024 - Good Friday
isGoodFriday(DateTime.fromISO('2024-03-29')); // true
// 30. march 2024 - Holy Saturday
isHolySaturday(DateTime.fromISO('2024-03-30')); // true
// 31. march 2024 - Easter Sunday
isEasterSunday(DateTime.fromISO('2024-03-31')); // true
// 1. april 2024 - Easter Monday
isEasterMonday(DateTime.fromISO('2024-04-01')); // true
```
### Holy Week
You can also check if given date is part of the Holy Week.
Holy Week is the week before Easter plus Easter Monday.
Starts with Palm Sunday and ends with Easter Monday.
```javascript
import {isHolyWeek, getHollyWeekInterval} from 'holidays-cs';
// 29. march 2024
isHolyWeek(DateTime.fromISO('2024-03-29')); // true it's Good Friday
// Get the Holy Week interval
getHollyWeekInterval(2024) // {start: DateTime, end: DateTime}
```
You can also get the name of the day in the Holy Week:
```javascript
import {DateTime} from 'luxon';
import {getEasterDayName} from 'holidays-cs';
getEasterDayName(DateTime.fromISO('2024-03-29')); // Velký pátek
```
## Get day metadata
You can get metadata for a given date:
```javascript
import {DateTime} from 'luxon';
import {getDayMeta} from 'holidays-cs';
const meta = getDayMeta(DateTime.fromISO('2024-05-15'));
meta.isPublicHoliday; // false ...
```
The metadata object looks like this:
```typescript
export type SignificantDay = {
name: string;
description: string;
year?: number;
};
export type EasterMetadata = {
name: string | undefined;
isGoodFriday: boolean;
isHolySaturday: boolean;
ieEasterSunday: boolean;
isEasterMonday: boolean;
};
export type DayMetadata = {
// Significant days metadata
isSignificantDay: boolean;
significantDay?: SignificantDay;
// Public holidays metadata
isPublicHoliday: boolean;
publicHoliday?: string | undefined;
// Easter metadata
isHolyWeek: boolean;
easter?: EasterMetadata | undefined;
// Shops metadata
shops: {areOpen: boolean; status: string};
};
```
## Credits
- [Zákon č. 245/2000 Sb., o státních svátcích a národních svátcích České republiky](https://www.mpsv.cz/web/cz/zakon-c.-245-2000-sb.-ze-dne-29.-cervna-2000-)
## License
[MIT](./LICENSE)