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

Method fromMap

packages/graph/src/TemporalTypes.ts:797–822  ·  view source on GitHub ↗

* Create a DateTimeValue from a map of components.

(map: Record<string, unknown>)

Source from the content-addressed store, hash-verified

795 * Create a DateTimeValue from a map of components.
796 */
797 public static fromMap(map: Record<string, unknown>): DateTimeValue | null {
798 const year = typeof map.year === "number" ? map.year : null;
799 const month = typeof map.month === "number" ? map.month : null;
800 const day = typeof map.day === "number" ? map.day : null;
801
802 if (year === null || month === null || day === null) return null;
803
804 const hour = typeof map.hour === "number" ? map.hour : 0;
805 const minute = typeof map.minute === "number" ? map.minute : 0;
806 const second = typeof map.second === "number" ? map.second : 0;
807 const nanosecond = typeof map.nanosecond === "number" ? map.nanosecond : 0;
808 const offsetSeconds = typeof map.offset === "number" ? map.offset : 0;
809 const timezone = typeof map.timezone === "string" ? map.timezone : null;
810
811 return new DateTimeValue(
812 year,
813 month,
814 day,
815 hour,
816 minute,
817 second,
818 nanosecond,
819 offsetSeconds,
820 timezone,
821 );
822 }
823
824 // Date properties
825 public get year(): number {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected