public static function isCzechHoliday($date)
    {
        if (!$date instanceof DateTime) {
            if (\is_int($date)) {
                $date = new DateTime('@' . $date);
            } elseif (\is_string($date)) {
                $date = new DateTime($date);
            } else {
                throw new RuntimeException(self::poorManTranslate('fts-shared', 'Invalid date format'));
            }
        }

        $holidays = ['01-01', '05-01', '05-08', '07-05', '07-06', '09-28', '10-28', '11-17', '12-24', '12-25', '12-26'];

        if (\in_array($date->format('m-d'), $holidays, true)) {
            return true;
        }

        //Easter
        $easterDays = easter_days($date->format('Y')); //Return number of days from base to easter sunday
        $easter = new DateTime($date->format('Y') . '-03-21');
        $easter->add(new \DateInterval('P' . $easterDays . 'D')); //Sunday
        $easter->sub(new \DateInterval('P2D')); //Friday
        if ($date->format('Y-m-d') === $easter->format('Y-m-d')) {
            return true;
        }
        $easter->add(new \DateInterval('P3D')); //Monday

        return ($easter->format('Y-m-d') === $date->format('Y-m-d'));
    }
public static function isCzechHoliday($date)
    {
        if (!$date instanceof DateTime) {
            if (\is_int($date)) {
                $date = new DateTime('@' . $date);
            } elseif (\is_string($date)) {
                $date = new DateTime($date);
            } else {
                throw new RuntimeException(self::poorManTranslate('fts-shared', 'Invalid date format'));
            }
        }

        $holidays = ['01-01', '05-01', '05-08', '07-05', '07-06', '09-28', '10-28', '11-17', '12-24', '12-25', '12-26'];

        if (\in_array($date->format('m-d'), $holidays, true)) {
            return true;
        }

        //Easter
        $easterDays = easter_days($date->format('Y')); //Return number of days from base to easter sunday
        $easter = new DateTime($date->format('Y') . '-03-21');
        $easter->add(new \DateInterval('P' . $easterDays . 'D')); //Sunday
        $easter->sub(new \DateInterval('P2D')); //Friday
        if ($date->format('Y-m-d') === $easter->format('Y-m-d')) {
            return true;
        }
        $easter->add(new \DateInterval('P3D')); //Monday

        return ($easter->format('Y-m-d') === $date->format('Y-m-d'));
    }
public static function isCzechHoliday ( $ date ) { if ( ! $ date instanceof DateTime ) { if ( \ is_int ( $ date ) ) { $ date = new DateTime ( '@' . $ date ) ; } elseif ( \ is_string ( $ date ) ) { $ date = new DateTime ( $ date ) ; } else { throw new RuntimeException ( self :: poorManTranslate ( 'fts-shared' , 'Invalid date format' ) ) ; } } $ holidays = [ '01-01' , '05-01' , '05-08' , '07-05' , '07-06' , '09-28' , '10-28' , '11-17' , '12-24' , '12-25' , '12-26' ] ; if ( \ in_array ( $ date -> format ( 'm-d' ) , $ holidays , true ) ) { return true ; } //Easter $ easterDays = easter_days ( $ date -> format ( 'Y' ) ) ; //Return number of days from base to easter sunday $ easter = new DateTime ( $ date -> format ( 'Y' ) . '-03-21' ) ; $ easter -> add ( new \ DateInterval ( 'P' . $ easterDays . 'D' ) ) ; //Sunday $ easter -> sub ( new \ DateInterval ( 'P2D' ) ) ; //Friday if ( $ date -> format ( 'Y-m-d' ) === $ easter -> format ( 'Y-m-d' ) ) { return true ; } $ easter -> add ( new \ DateInterval ( 'P3D' ) ) ; //Monday return ( $ easter -> format ( 'Y-m-d' ) === $ date -> format ( 'Y-m-d' ) ) ; }
Whether the specified date is Czech holiday

@param string|DateTime|int $date Any valid date or datetime

@return bool Is holiday
@throws \Exception
@throws RuntimeException
@static
Whether the specified date is Czech holiday