holidays-cs
Advanced tools
Comparing version 2.0.8 to 2.1.0
@@ -1,2 +0,2 @@ | ||
import { DateTime, Interval } from 'luxon'; | ||
import { DateTime, Interval } from "luxon"; | ||
/** | ||
@@ -3,0 +3,0 @@ * Returns the date of Easter Monday for a given year. |
@@ -1,3 +0,3 @@ | ||
import { DateTime, Interval } from 'luxon'; | ||
import * as EasterDate from 'easter-date'; | ||
import * as EasterDate from "easter-date"; | ||
import { DateTime, Interval } from "luxon"; | ||
/** | ||
@@ -87,3 +87,5 @@ * Returns the date of Easter Monday for a given year. | ||
} | ||
return interval.start && interval.end ? interval.start <= date && date <= interval.end : false; | ||
return interval.start && interval.end | ||
? interval.start <= date && date <= interval.end | ||
: false; | ||
} | ||
@@ -94,11 +96,11 @@ /** | ||
const names = { | ||
'-7': 'Květná neděle', | ||
'-6': 'Modré pondělí', | ||
'-5': 'Šedivé úterý', | ||
'-4': 'Škaredá středa', | ||
'-3': 'Zelený čtvrtek', | ||
'-2': 'Velký pátek', | ||
'-1': 'Bílá sobota', | ||
'0': 'Velikonoční neděle', | ||
'1': 'Velikonoční pondělí', | ||
"-7": "Květná neděle", | ||
"-6": "Modré pondělí", | ||
"-5": "Šedivé úterý", | ||
"-4": "Škaredá středa", | ||
"-3": "Zelený čtvrtek", | ||
"-2": "Velký pátek", | ||
"-1": "Bílá sobota", | ||
"0": "Velikonoční neděle", | ||
"1": "Velikonoční pondělí", | ||
}; | ||
@@ -112,3 +114,3 @@ /** | ||
date = date instanceof Date ? DateTime.fromJSDate(date) : date; | ||
const index = date.diff(getEaster(date.year), 'days').as('days'); | ||
const index = date.diff(getEaster(date.year), "days").as("days"); | ||
return index in names ? names[index] : undefined; | ||
@@ -115,0 +117,0 @@ } |
@@ -1,3 +0,3 @@ | ||
import { DateTime } from 'luxon'; | ||
import { type SignificantDay } from './significant.js'; | ||
import { DateTime } from "luxon"; | ||
import { type SignificantDay } from "./significant.js"; | ||
export type EasterMetadata = { | ||
@@ -4,0 +4,0 @@ name: string | undefined; |
@@ -1,6 +0,6 @@ | ||
import { DateTime } from 'luxon'; | ||
import { getPublicHoliday, isPublicHoliday } from './holidays.js'; | ||
import { getSignificantDay, isSignificantDay } from './significant.js'; | ||
import { areShopsOpen, getShopsStatus } from './shops.js'; | ||
import { getEasterDayName, isEasterMonday, isEasterSunday, isGoodFriday, isHolySaturday, isHolyWeek, } from './easter.js'; | ||
import { DateTime } from "luxon"; | ||
import { getEasterDayName, isEasterMonday, isEasterSunday, isGoodFriday, isHolySaturday, isHolyWeek, } from "./easter.js"; | ||
import { getPublicHoliday, isPublicHoliday } from "./holidays.js"; | ||
import { areShopsOpen, getShopsStatus } from "./shops.js"; | ||
import { getSignificantDay, isSignificantDay, } from "./significant.js"; | ||
/** | ||
@@ -7,0 +7,0 @@ * Get metadata for a specific day |
@@ -1,2 +0,2 @@ | ||
import { DateTime } from 'luxon'; | ||
import { DateTime } from "luxon"; | ||
/** | ||
@@ -3,0 +3,0 @@ * Check if the given date is a holiday |
@@ -1,3 +0,3 @@ | ||
import { DateTime } from 'luxon'; | ||
import { getEasterDayName, getEasterMonday, getGoodFriday, isEasterMonday, isGoodFriday, } from './easter.js'; | ||
import { DateTime } from "luxon"; | ||
import { getEasterDayName, getEasterMonday, getGoodFriday, isEasterMonday, isGoodFriday, } from "./easter.js"; | ||
/** | ||
@@ -7,13 +7,13 @@ * Zákon č. 245/2000 Sb., o státních svátcích a národních svátcích České republiky | ||
const holidays = { | ||
'0101': 'Den obnovy samostatného českého státu', | ||
'0105': 'Svátek práce', | ||
'0805': 'Den vítězství (1945)', | ||
'0507': 'Den slovanských věrozvěstů Cyrila a Metoděje', | ||
'0607': 'Den upálení mistra Jana Husa (1415)', | ||
'2809': 'Den české státnosti', | ||
'2810': 'Den vzniku samostatného československého státu (1918)', | ||
'1711': 'Den boje za svobodu a demokracii (1939 a 1989)', | ||
'2412': 'Štědrý den', | ||
'2512': 'První svátek vánoční', | ||
'2612': 'Druhý svátek vánoční', | ||
"0101": "Den obnovy samostatného českého státu", | ||
"0105": "Svátek práce", | ||
"0805": "Den vítězství (1945)", | ||
"0507": "Den slovanských věrozvěstů Cyrila a Metoděje", | ||
"0607": "Den upálení mistra Jana Husa (1415)", | ||
"2809": "Den české státnosti", | ||
"2810": "Den vzniku samostatného československého státu (1918)", | ||
"1711": "Den boje za svobodu a demokracii (1939 a 1989)", | ||
"2412": "Štědrý den", | ||
"2512": "První svátek vánoční", | ||
"2612": "Druhý svátek vánoční", | ||
}; | ||
@@ -26,3 +26,5 @@ /** | ||
date = date instanceof Date ? DateTime.fromJSDate(date) : date; | ||
return isEasterMonday(date) || isGoodFriday(date) || date.toFormat('ddMM') in holidays; | ||
return (isEasterMonday(date) || | ||
isGoodFriday(date) || | ||
date.toFormat("ddMM") in holidays); | ||
} | ||
@@ -41,3 +43,3 @@ /** | ||
} | ||
return holidays[date.toFormat('ddMM')]; | ||
return holidays[date.toFormat("ddMM")]; | ||
} | ||
@@ -52,5 +54,5 @@ /** | ||
if (Object.hasOwn(holidays, date)) { | ||
const key = DateTime.fromFormat(date, 'ddMM').set({ year }).toISODate(); | ||
const key = DateTime.fromFormat(date, "ddMM").set({ year }).toISODate(); | ||
if (key !== null) { | ||
list.set(key, holidays[date] ?? ''); | ||
list.set(key, holidays[date] ?? ""); | ||
} | ||
@@ -60,6 +62,6 @@ } | ||
const goodFriday = getGoodFriday(year); | ||
list.set(goodFriday.toISODate() ?? '', getEasterDayName(goodFriday) ?? ''); | ||
list.set(goodFriday.toISODate() ?? "", getEasterDayName(goodFriday) ?? ""); | ||
const easterMonday = getEasterMonday(year); | ||
list.set(easterMonday.toISODate() ?? '', getEasterDayName(easterMonday) ?? ''); | ||
list.set(easterMonday.toISODate() ?? "", getEasterDayName(easterMonday) ?? ""); | ||
return list; | ||
} |
@@ -1,5 +0,5 @@ | ||
export * from './easter.js'; | ||
export * from './holidays.js'; | ||
export * from './significant.js'; | ||
export * from './shops.js'; | ||
export * from './get-meta.js'; | ||
export * from "./easter.js"; | ||
export * from "./holidays.js"; | ||
export * from "./significant.js"; | ||
export * from "./shops.js"; | ||
export * from "./get-meta.js"; |
@@ -1,5 +0,5 @@ | ||
export * from './easter.js'; | ||
export * from './holidays.js'; | ||
export * from './significant.js'; | ||
export * from './shops.js'; | ||
export * from './get-meta.js'; | ||
export * from "./easter.js"; | ||
export * from "./holidays.js"; | ||
export * from "./significant.js"; | ||
export * from "./shops.js"; | ||
export * from "./get-meta.js"; |
@@ -1,2 +0,2 @@ | ||
import { DateTime } from 'luxon'; | ||
import { DateTime } from "luxon"; | ||
/** | ||
@@ -3,0 +3,0 @@ * Returns the shop status for the given date. |
@@ -1,3 +0,3 @@ | ||
import { DateTime } from 'luxon'; | ||
import { isEasterMonday } from './easter.js'; | ||
import { DateTime } from "luxon"; | ||
import { isEasterMonday } from "./easter.js"; | ||
/** | ||
@@ -8,8 +8,8 @@ * List of days when the shop is closed. | ||
const closed = { | ||
'0101': 'Nový rok', | ||
'0805': 'Den vítězství', | ||
'2809': 'Den české státnosti', | ||
'2810': 'Den vzniku samostatného československého státu', | ||
'2512': '1. svátek vánoční', | ||
'2612': '2. svátek vánoční', | ||
"0101": "Nový rok", | ||
"0805": "Den vítězství", | ||
"2809": "Den české státnosti", | ||
"2810": "Den vzniku samostatného československého státu", | ||
"2512": "1. svátek vánoční", | ||
"2612": "2. svátek vánoční", | ||
}; | ||
@@ -24,10 +24,10 @@ /** | ||
if (isEasterMonday(date)) { | ||
return 'zavřeno'; | ||
return "zavřeno"; | ||
} | ||
// Christmas Eve | ||
if (date.toFormat('ddMM') === '2412') { | ||
return 'otevřeno do 12:00'; | ||
if (date.toFormat("ddMM") === "2412") { | ||
return "otevřeno do 12:00"; | ||
} | ||
// Other closed days | ||
return date.toFormat('ddMM') in closed ? 'zavřeno' : 'otevřeno'; | ||
return date.toFormat("ddMM") in closed ? "zavřeno" : "otevřeno"; | ||
} | ||
@@ -40,3 +40,3 @@ /** | ||
date = date instanceof Date ? DateTime.fromJSDate(date) : date; | ||
return getShopsStatus(date).startsWith('otevřeno'); | ||
return getShopsStatus(date).startsWith("otevřeno"); | ||
} |
@@ -1,2 +0,2 @@ | ||
import { DateTime } from 'luxon'; | ||
import { DateTime } from "luxon"; | ||
/** | ||
@@ -3,0 +3,0 @@ * Represents a significant day. |
@@ -1,3 +0,3 @@ | ||
import { DateTime } from 'luxon'; | ||
import data from './significant.json' with { type: 'json' }; | ||
import { DateTime } from "luxon"; | ||
import data from "./significant.json" with { type: "json" }; | ||
/** | ||
@@ -13,3 +13,3 @@ * Zákon č. 245/2000 Sb., o státních svátcích a národních svátcích České republiky | ||
date = date instanceof Date ? DateTime.fromJSDate(date) : date; | ||
return significant[date.toFormat('ddMM')]; | ||
return significant[date.toFormat("ddMM")]; | ||
} | ||
@@ -22,3 +22,3 @@ /** | ||
date = date instanceof Date ? DateTime.fromJSDate(date) : date; | ||
return date.toFormat('ddMM') in significant; | ||
return date.toFormat("ddMM") in significant; | ||
} |
129
package.json
{ | ||
"name": "holidays-cs", | ||
"version": "2.0.8", | ||
"author": "Roman Ožana <roman@ozana.cz> (https://ozana.cz)", | ||
"repository": "OzzyCzech/holidays-cs", | ||
"license": "MIT", | ||
"description": "Public holidays, Easter, name days and important days in the Czech Republic.", | ||
"keywords": [ | ||
"czechia", | ||
"czech republic", | ||
"public holidays", | ||
"holidays", | ||
"name day", | ||
"easter" | ||
], | ||
"type": "module", | ||
"exports": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"scripts": { | ||
"build": "rm -rf dist && tsc", | ||
"release": "np --no-release-draft", | ||
"prepare": "npm run build", | ||
"test": "xo && tsc --noEmit && NODE_OPTIONS='--import=tsx/esm' ava", | ||
"ava": "NODE_OPTIONS='--import=tsx/esm' ava" | ||
}, | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/*" | ||
], | ||
"dependencies": { | ||
"easter-date": "0.0.17", | ||
"luxon": "^3.5.0" | ||
}, | ||
"devDependencies": { | ||
"@types/luxon": "^3.4.2", | ||
"@types/node": "^22.7.0", | ||
"ava": "^6.1.2", | ||
"np": "^10.0.7", | ||
"tsx": "^4.19.1", | ||
"typescript": "^5.6.2", | ||
"xo": "^0.59.3" | ||
}, | ||
"ava": { | ||
"timeout": "1m", | ||
"extensions": { | ||
"ts": "module" | ||
}, | ||
"files": [ | ||
"test/*" | ||
], | ||
"workerThreads": false, | ||
"nodeArguments": [ | ||
"--experimental-json-modules", | ||
"--no-warnings" | ||
] | ||
}, | ||
"xo": { | ||
"rules": { | ||
"@typescript-eslint/naming-convention": "off", | ||
"quote-props": "off" | ||
} | ||
} | ||
"name": "holidays-cs", | ||
"version": "2.1.0", | ||
"author": "Roman Ožana <roman@ozana.cz> (https://ozana.cz)", | ||
"repository": "OzzyCzech/holidays-cs", | ||
"license": "MIT", | ||
"description": "Public holidays, Easter, name days and important days in the Czech Republic.", | ||
"keywords": [ | ||
"czechia", | ||
"czech republic", | ||
"public holidays", | ||
"holidays", | ||
"name day", | ||
"easter" | ||
], | ||
"type": "module", | ||
"exports": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"scripts": { | ||
"build": "rm -rf dist && tsc", | ||
"release": "np --no-release-draft", | ||
"prepare": "npm run build", | ||
"format": "biome format --write", | ||
"test": "biome ci && tsc --noEmit && NODE_OPTIONS='--import=tsx/esm' ava", | ||
"ava": "NODE_OPTIONS='--import=tsx/esm' ava" | ||
}, | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/*" | ||
], | ||
"dependencies": { | ||
"easter-date": "0.0.18", | ||
"luxon": "^3.5.0" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "1.9.3", | ||
"@types/luxon": "^3.4.2", | ||
"@types/node": "^22.7.5", | ||
"ava": "^6.1.2", | ||
"np": "^10.0.7", | ||
"tsx": "^4.19.1", | ||
"typescript": "^5.6.2" | ||
}, | ||
"ava": { | ||
"timeout": "1m", | ||
"extensions": { | ||
"ts": "module" | ||
}, | ||
"files": [ | ||
"test/*" | ||
], | ||
"workerThreads": false, | ||
"nodeArguments": [ | ||
"--experimental-json-modules", | ||
"--no-warnings" | ||
] | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
511
24494
+ Addedeaster-date@0.0.18(transitive)
- Removedeaster-date@0.0.17(transitive)
Updatedeaster-date@0.0.18