ValidatorOptional

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.

import { Component } from '@angular/core';
import { WrDatePicker } from 'ngwr/date-picker';
import { WrValidators } from 'ngwr/validators';

@Component({ imports: [WrDatePicker] })
export class MyComponent {}

Live demo

Minimum is 2026-01-01. Earlier dates fail.

errors: null

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

NameDescriptionTypeDefault
signatureCall it with a Date, an ISO string or epoch ms. A date-only string is local midnight.(min: Date | string | number) => ValidatorFn—
error keyOn failure: { minDate: { min } }, the bound as you passed it. Empty value passes.{ minDate: { min } }—

See also