MCPcopy Create free account
hub / github.com/arktypeio/arktype / isValidDate

Function isValidDate

ark/util/objectKinds.ts:263–271  ·  view source on GitHub ↗
(date: Date)

Source from the content-addressed store, hash-verified

261
262// repeats timeOf, whose call measurably slows validating a Date
263export const isValidDate = (date: Date): boolean => {
264 try {
265 return !Number.isNaN(
266 date.getTime === dateGetTime ? date.getTime() : dateGetTime.call(date)
267 )
268 } catch {
269 return false
270 }
271}
272
273export const isDateObject = (value: object): value is Date =>
274 prototypeOf(value) === Date.prototype

Callers 9

printFunction · 0.90
de.tsFile · 0.90
parseSchema.tsFile · 0.90
ProtoNodeClass · 0.90
writeUnitActualFunction · 0.90
writeProtoActualFunction · 0.90
constructorFunction · 0.90
describeCollapsibleDateFunction · 0.90
tryParseDateFunction · 0.85

Calls 2

getTimeMethod · 0.80
callMethod · 0.80

Tested by

no test coverage detected