Skip to main content

minDate()

🧭 API map​

I want to…Details
See every accepted call styleSignatures
See common and advanced usageUsage and behavior
Customize messagesMessage configuration
Understand reactive constraintsReactive behavior
Return to the complete catalogBuilt-in validators

πŸ“ Signatures​

minDate(minimum)
minDate(minimum, message)
minDate(minimum, options)

Reactive constraint arguments use a zero-argument function. The function may read signals and, where supported, return undefined to disable the constraint temporarily.

πŸ“– Usage and behavior​

Requires a valid date on or after an inclusive minimum:

const myForm = form({
appointment: field<Date>(null, [minDate('2026-08-24')]),
sameDayAppointment: field<Date>(null, [minDate('today')]),
reactiveTodayAppointment: field<Date>(null, [minDate(() => 'today')]),
earliestAppointment: field<Date>(null, [minDate(() => bookingWindowStart())]),
localAppointment: field<Date>(null, [
minDate('2026-08-24', {
parseAs: 'local',
}),
]),
messagedAppointment: field<Date>(null, [
minDate('2026-08-24', 'Choose a later date.'),
]),
momentAppointment: field<Date>(null, [
minDate(moment('2026-08-24').toDate()),
]),
});

The limit accepts a Date, an ISO calendar-date string (YYYY-MM-DD), the relative shortcut 'today', or a reactive function returning any of them. Strings and the shortcut use UTC midnight by default; parseAs: 'local' selects local midnight. The shortcut is resolved when validation runs, so minDate('today') does not permanently capture its declaration date. The library does not create a midnight timer; after the day changes, the boundary updates on the next value or reactive dependency change. null and invalid current dates pass. An absent or invalid resolved limit disables the constraint. A failure is { kind: 'minDate', minDate, actual, message }. The normalized Date contributes to min() metadata.

πŸ’¬ Message configuration​

Every failure has a default English message. Where supported, pass a string as the final argument or use an options object for a static or reactive message, as shown above.

A message function may read signals. Returning undefined continues through node, Angular provider, process-wide, and built-in message fallbacks. See Validator messages.

⚑ Reactive behavior​

The options object accepts a reactive when predicate. Signals read from its validator context are tracked; while it returns false, the rule contributes neither errors nor constraint metadata.

const enforceBookingWindow = signal(false);
const departure = field(new Date('2026-05-01'), [
minDate('2026-06-01', { when: () => enforceBookingWindow() })
]);

Reactive constraint functions and message functions track the signals they read. When a resolved constraint becomes unavailable, validators that support optional constraint sources temporarily stop contributing their error and metadata.

The validator runs synchronously as part of its node's validator source. Disabled, readonly, and hidden nodes skip validation until they become interactive again.