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;
    }