MCPcopy Create free account
hub / github.com/codemix/graph / fromMap

Method fromMap

packages/graph/src/TemporalTypes.ts:550–563  ·  view source on GitHub ↗

* Create a LocalDateTimeValue from a map of components.

(map: Record<string, unknown>)

Source from the content-addressed store, hash-verified

548 * Create a LocalDateTimeValue from a map of components.
549 */
550 public static fromMap(map: Record<string, unknown>): LocalDateTimeValue | null {
551 const year = typeof map.year === "number" ? map.year : null;
552 const month = typeof map.month === "number" ? map.month : null;
553 const day = typeof map.day === "number" ? map.day : null;
554
555 if (year === null || month === null || day === null) return null;
556
557 const hour = typeof map.hour === "number" ? map.hour : 0;
558 const minute = typeof map.minute === "number" ? map.minute : 0;
559 const second = typeof map.second === "number" ? map.second : 0;
560 const nanosecond = typeof map.nanosecond === "number" ? map.nanosecond : 0;
561
562 return new LocalDateTimeValue(year, month, day, hour, minute, second, nanosecond);
563 }
564
565 // Date properties
566 public get year(): number {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected