src/php/Arbit/Periodic/CronjobIterator.php
protected function isValidDate( $year, $month, $day )
    {
        // Some basic sanity checking
        if ( $month <= 0 || $month > 12 || $day <= 0 || $day > 31 )
        {
            return false;
        }

        // Check for months with 30 days
        if (   ( $month == 4 || $month == 6 || $month == 9 || $month == 11 )
            && ( $day == 31 ) )
        {
            return false;
        }

        // Check for februaries
        if ( $month == 2 )
        {
            // Februrary has a maximum of 29 dates (in a leap year)
            if ( $day > 29 )
            {
                return false;
            }
            // Check if it is a leap year
            $leap = date( 'L', strtotime( $year . '-01-01' ) );
            if ( $leap === '0' && $day > 28 )
            {
                return false;
            }
        }

        return true;
    }
protected function isValidDate( $year, $month, $day )
    {
        // Some basic sanity checking
        if ( $month <= 0 || $month > 12 || $day <= 0 || $day > 31 )
        {
            return false;
        }

        // Check for months with 30 days
        if (   ( $month == 4 || $month == 6 || $month == 9 || $month == 11 )
            && ( $day == 31 ) )
        {
            return false;
        }

        // Check for februaries
        if ( $month == 2 )
        {
            // Februrary has a maximum of 29 dates (in a leap year)
            if ( $day > 29 )
            {
                return false;
            }
            // Check if it is a leap year
            $leap = date( 'L', strtotime( $year . '-01-01' ) );
            if ( $leap === '0' && $day > 28 )
            {
                return false;
            }
        }

        return true;
    }
Check if the given year, month and day combination is a valid calendar
entry

@param int $year Year to be checked
@param int $month Month to be checked
@param int $day Day to be checked
@return bool True if it is a valid date false otherwise