MCPcopy Create free account
hub / github.com/codemix/graph / #formatOffset

Method #formatOffset

packages/graph/src/TemporalTypes.ts:971–980  ·  view source on GitHub ↗

* Format timezone offset as +HH:MM or -HH:MM.

()

Source from the content-addressed store, hash-verified

969 * Format timezone offset as +HH:MM or -HH:MM.
970 */
971 #formatOffset(): string {
972 if (this.#offsetSeconds === 0 && !this.#timezone) return "Z";
973
974 const sign = this.#offsetSeconds >= 0 ? "+" : "-";
975 const absSeconds = Math.abs(this.#offsetSeconds);
976 const hours = Math.floor(absSeconds / 3600);
977 const mins = Math.floor((absSeconds % 3600) / 60);
978
979 return `${sign}${String(hours).padStart(2, "0")}:${String(mins).padStart(2, "0")}`;
980 }
981
982 /**
983 * Convert to ISO string with timezone.

Callers 1

toStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected