year
year<
T>(fieldPath,config?):void
Defined in: projects/ngx-signal-schema/src/lib/validators/year.ts:27
Validates a year text field (exactly 4 digits, e.g., “2023”).
It ensures the value:
- Has a maximum length of 4 characters.
- Has a minimum length of 4 characters.
- Consists only of digits.
Type Parameters
Section titled “Type Parameters”T extends string
Parameters
Section titled “Parameters”fieldPath
Section titled “fieldPath”SchemaPath<T>
The schema path to the year field to validate.
config?
Section titled “config?”Provides custom error options for validation errors.
Returns
Section titled “Returns”void
Important
Section titled “Important”Unexpectedly the custom error kind will NOT override the default error kind for minLength and maxLength, only the error kind for the pattern.
Example
Section titled “Example”year(path.birthYear);