DateRangeValidatorPatterns

FinalYes

Central definition of date validation patterns.

Internal

Table of Contents

Constants

RFC3339_FULL_DATE  = '\d{4}-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])'
RFC3339_FULL_DATE_PCRE  = '/^' . self::RFC3339_FULL_DATE . '$/'

Methods

isRelativeDateExpression()  : bool
Check whether a string is a relative date expression.
parseRelativeDateExpression()  : DateTime|null
Try to parse a relative date expression using PHP's DateTime parser.

Constants

RFC3339_FULL_DATE

public mixed RFC3339_FULL_DATE = '\d{4}-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])'

RFC3339_FULL_DATE_PCRE

public mixed RFC3339_FULL_DATE_PCRE = '/^' . self::RFC3339_FULL_DATE . '$/'

Methods

isRelativeDateExpression()

Check whether a string is a relative date expression.

public static isRelativeDateExpression(string $value) : bool

A relative date is defined as any non-empty string that does NOT match an RFC 3339 full-date (YYYY-MM-DD). Actual validity is determined by PHP's DateTime parser (strtotime).

Parameters
$value : string
Return values
bool

parseRelativeDateExpression()

Try to parse a relative date expression using PHP's DateTime parser.

public static parseRelativeDateExpression(string $value) : DateTime|null

Returns the resulting DateTime or null if the expression is invalid.

Parameters
$value : string
Return values
DateTime|null

        
On this page

Search results