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

Method toString

packages/graph/src/TemporalTypes.ts:665–681  ·  view source on GitHub ↗

* Convert to ISO string (YYYY-MM-DDTHH:MM:SS.nnnnnnnnn).

()

Source from the content-addressed store, hash-verified

663 * Convert to ISO string (YYYY-MM-DDTHH:MM:SS.nnnnnnnnn).
664 */
665 public toString(): string {
666 const y = String(this.#year).padStart(4, "0");
667 const mo = String(this.#month).padStart(2, "0");
668 const d = String(this.#day).padStart(2, "0");
669 const h = String(this.#hour).padStart(2, "0");
670 const mi = String(this.#minute).padStart(2, "0");
671 const s = String(this.#second).padStart(2, "0");
672
673 let result = `${y}-${mo}-${d}T${h}:${mi}:${s}`;
674 if (this.#nanosecond > 0) {
675 let nanos = String(this.#nanosecond).padStart(9, "0");
676 nanos = nanos.replace(/0+$/, "");
677 result += `.${nanos}`;
678 }
679
680 return result;
681 }
682
683 public compareTo(other: LocalDateTimeValue): number {
684 if (this.#year !== other.#year) return this.#year - other.#year;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected