Date
in package
implements
RuleInterface
Date validation rule.
Validates that a value is a valid date.
Table of Contents
Interfaces
- RuleInterface
- Interface for validation rules.
Methods
- validate() : bool
- The date rule (CUVR-058): a string, trimmed, in one of the layouts with a calendar day, or an RFC 3339 date-time with a valid time and offset. A number is not a date.
- isDayText() : bool
- Whether a trimmed text is YYYY-MM-DD, YYYY/MM/DD, MM/DD/YYYY or DD/MM/YYYY naming a calendar day.
Methods
validate()
The date rule (CUVR-058): a string, trimmed, in one of the layouts with a calendar day, or an RFC 3339 date-time with a valid time and offset. A number is not a date.
public
validate(mixed $value, mixed $param, array<string|int, mixed> $allData, FieldPath $path) : bool
Parameters
- $value : mixed
-
The value to validate
- $param : mixed
-
The rule parameter (e.g., min length, pattern, etc.)
- $allData : array<string|int, mixed>
-
All form data (for cross-field validation)
- $path : FieldPath
-
The data path of the value with the positions of its row keys
Return values
bool —True if valid, false otherwise
isDayText()
Whether a trimmed text is YYYY-MM-DD, YYYY/MM/DD, MM/DD/YYYY or DD/MM/YYYY naming a calendar day.
private
static isDayText(string $text) : bool
Parameters
- $text : string