@northguild/gmt
Version:
Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.
12 lines • 598 B
TypeScript
/**
* The shared core of `parseSqlDateTime` and `isValidSqlDateTime`: read a SQL timestamp literal
* without a time zone and return it as a plain ISO 8601 datetime string, or `""` when it is not
* one. Never throws.
*
* @param value - The text to read.
* @returns `YYYY-MM-DDTHH:MM:SS[.f]`, or `""` for any other value.
* @example readSqlDateTime("2024-03-15 14:30:00.500") // "2024-03-15T14:30:00.5"
* @example readSqlDateTime("2024-02-30 14:30:00") // ""
* @example readSqlDateTime(42) // ""
*/
export declare function readSqlDateTime(value: unknown): string;