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