parseDateTime
parseDateTime<
T>(spec,format?):MapSpec<T>
Defined in: extract/spec.ts:844
Parse a string value into an ISO datetime string.
Without format: validates the input as an ISO datetime and returns it as-is.
With format: compiles the format string into a parser that converts the
input string into an ISO datetime.
Tokens (uppercase = strict 2-digit, lowercase/single = lenient 1-2 digit):
YYYY(4-digit year),YY(2-digit year: <70 → 20xx, >=70 → 19xx)MM/M(month),DD/D(day)HH/H(hour),mm/m(minute),ss/s(second)
Produces schemaHint: { type: 'string', format: 'date-time' } for schema derivation.
Type Parameters
Section titled “Type Parameters”T extends Spec
Parameters
Section titled “Parameters”T
format?
Section titled “format?”string
Returns
Section titled “Returns”MapSpec<T>
Example
Section titled “Example”// ISO validationparseDateTime($.get('timestamp').string())
// Strict zero-padded formatparseDateTime($.get('timestamp').string(), 'MM/DD/YYYY HH:mm:ss')
// Lenient formatparseDateTime($.get('timestamp').string(), 'M/D/YY H:m:s')