import { Component } from '@angular/core';
import { WrDatePicker } from 'ngwr/date-picker';
import { WrValidators } from 'ngwr/validators';
@Component({ imports: [WrDatePicker] })
export class MyComponent {}maxDate
Reject a date after max.
Installation
Import the class, and @use the entry point in your global styles: without it the component renders unstyled.
Live demo
Maximum is 2026-12-31. Later dates fail.
Usage
import { FormControl } from '@angular/forms';
import { WrValidators } from 'ngwr/validators';
const end = new FormControl('', [
WrValidators.maxDate('2026-12-31'),
]);API
| Name | Description | Type | Default |
|---|---|---|---|
signature | Call it with a Date, an ISO string or epoch ms. A date-only string is local midnight. | (max: Date | string | number) => ValidatorFn | — |
error key | On failure: { maxDate: { max } }, the bound as you passed it. Empty value passes. | { maxDate: { max } } | — |