Date Verifier Reference
Created by should().date(entry: Date | string | null | undefined) — a Date instance or an ISO string; both are normalized before any check.
Type
Methods
Method | Passes when |
|---|---|
| both dates, truncated to |
|
|
|
|
|
|
Plus the inherited not and defined().
Representative messages
`${real} does not equal ${expected}.`(equals)`${real} is not before ${then}.`/`${real} is not after ${then}.``${real} isn't in range [${min}, ${max}].`(inRange)
Accuracy semantics
Truncation drops the smaller units from both sides before comparing:
'day'— compares year/month/day only;'month'— compares year/month;'year'— compares the year;'hour'/'minute'/'second'— keep time down to the named unit;'millisecond'(default) — exact comparison.
Unparseable strings become an Invalid Date instead of null — the definedness guard does not catch them (Caveats).
Guide: Dates.