Repository navigation
Holidays
🎉
Public holidays by language in PHP: namespace Timely\Holidays.
Abstract class Timely\Holidays\Finder; a subclass names its language by implementing language() and holidays are loaded from <language>/<language>.json. Throws InvalidArgumentException for an invalid or unknown language.
-
holidays(?int $year): Returns names of holidays by date (Y-m-d) for the year, the current one by default. -
name(?\DateTime $dateTime): Returns the name of the holiday, ornull. -
isHoliday(?\DateTime $dateTime): Checks if the date is a holiday. -
nextHoliday(?\DateTime $dateTime): Returns the first holiday after the date. -
afterHoliday(?\DateTime $dateTime, string $move = "weekday"): Returns the first day after the holiday that is not a holiday (the same day if it is not one).
Timely\Holidays\Czech\CzechFinder (czech/) and Timely\Holidays\Slovak\SlovakFinder (slovak/) extend NameDayFinder for the Czech and Slovak data:
use Timely\Holidays\Slovak\SlovakFinder;
(new SlovakFinder())->isHoliday(new \DateTime("2026-04-03")); // true
(new SlovakFinder())->name(new \DateTime("2026-04-03")); // "Veľký piatok"Each item of the JSON file has a name and either a date in j.n. format, or an easter offset in days from Easter Sunday (calculated by Easter):
[
{"date": "1.1.", "name": "Deň vzniku Slovenskej republiky"},
{"easter": -2, "name": "Veľký piatok"}
]To add a country, create src/timely/holidays/<language>/<language>.json and a NameDayFinder subclass like SlovakNameDayFinder.
Working-day calculations that use the holidays are in Dates. This namespace is PHP only and has no browser demo.