Skip to content

Function.date

github-actions[bot] edited this page May 13, 2026 · 30 revisions

umt / date

Function: date()

date(message?): (value) => ValidateCoreReturnType<Date>

Defined in: Validate/date/core.ts:16

Creates a Date validator. The validator checks both that the value is an instance of Date and that it represents a valid moment in time (i.e. its underlying timestamp is not NaN), so values created from invalid inputs such as new Date("not-a-date") are rejected.

Parameters

message?

string

Custom error message for type validation

Returns

  • Validator function that checks if the value is a Date instance

(value) => ValidateCoreReturnType<Date>

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally