MCPcopy Create free account
hub / github.com/angular/components / getValidDateOrNull

Function getValidDateOrNull

src/material/core/datetime/date-adapter.ts:255–257  ·  view source on GitHub ↗

* Given a potential date object, returns that same date object if it is * a valid date, or `null` if it's not a valid date. * @param obj The object to check. * @returns A date or `null`.

(obj: unknown)

Source from the content-addressed store, hash-verified

253 * @returns A date or `null`.
254 */
255 getValidDateOrNull(obj: unknown): D | null {
256 return this.isDateInstance(obj) && this.isValid(obj as D) ? (obj as D) : null;
257 }
258
259 /**
260 * Attempts to deserialize a value to a valid date object. This is different from parsing in that

Callers

nothing calls this directly

Calls 2

isDateInstanceMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected