Format
Anything `Date.parse()` accepts. Bounds may be ISO date strings (`1900-01-01`), full ISO timestamps, or the literal `today` which resolves to `Date.now()` at validation time.
Examples
- min: '1900-01-01', max: 'today' // date of birth
- min: 'today' // future-only (appointments)
- max: '2099-12-31' // open-ended past
Implementation
Faithful summary of lib/validators.ts. Validators are pure functions and run identically in the worker, the Workbench, and the MCP server.
function validDateRange(value, params) {
const t = Date.parse(value)
if (Number.isNaN(t)) return fail('date_invalid', 'not a parseable date')
const min = params.min === 'today' ? Date.now()
: params.min ? Date.parse(params.min) : -Infinity
const max = params.max === 'today' ? Date.now()
: params.max ? Date.parse(params.max) : Infinity
if (t < min) return fail('date_too_early', `before ${params.min}`)
if (t > max) return fail('date_too_late', `after ${params.max}`)
return OK
}Use in a template
Validators attach to a field on a custom template. The cascade runs them after mapping but before commit; failures surface in the per-row validation report.
fields:
- column: date_of_birth
type: date
format: auto
validators:
- type: date_range
min: '1900-01-01'
max: todayCommon gotchas
- Parsing is engine-dependent. `Date.parse("13/06/2024")` returns NaN in V8. Use ISO `YYYY-MM-DD` or pre-format in your transform.
- `today` resolves at validation time, not request time — there is no caching across rows in a batch.
- Time zone: bare dates parse as UTC midnight. A `min: today` boundary in non-UTC zones can reject rows that "look" current locally.
Related templates
Patient identity. Emits FHIR Patient.
Fields: date_of_birth
Pricing
Validators run on every committed row
Schema-only mode (headers + ≤3 sample rows) is free and unlimited; full-data commits are metered. See plans →