MCPcopy Create free account
hub / github.com/TanStack/db / toDateValue

Function toDateValue

packages/db/src/query/compiler/evaluators.ts:34–45  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

32}
33
34function toDateValue(value: any): Date | null {
35 if (value instanceof Date) {
36 return Number.isNaN(value.getTime()) ? null : value
37 }
38
39 if (typeof value === `string` || typeof value === `number`) {
40 const parsed = new Date(value)
41 return Number.isNaN(parsed.getTime()) ? null : parsed
42 }
43
44 return null
45}
46
47function evaluateStrftime(format: string, date: Date): string {
48 if (format === `%Y-%m-%d`) {

Callers 1

compileFunctionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected