public static function isWorkDay(\Jyxo\Time\Time $day) : bool
{
$holidays = self::$holidays;
// Adds Easter Monday. easter_date is supposed to be buggy http://cz.php.net/manual/en/function.easter-date.php#80664
$year = (int) $day->format('Y');
$days = easter_days($year);
// $days returns the number of days from March 21st until the Easter Sunday, +1 because of Monday
$holidays[] = date('j.n', strtotime($year . '-03-21 +' . ($days + 1) . ' days'));
$isWorkDay = true;
if ($day->format('N') > 5) {
// Saturday or Sunday
$isWorkDay = false;
} elseif (in_array($day->format('j.n'), $holidays)) {
// Public holiday, hurray!
$isWorkDay = false;
}
return $isWorkDay;
}