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

Method #formatOffset

packages/graph/src/TemporalTypes.ts:447–456  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

445 * Format timezone offset as +HH:MM or -HH:MM.
446 */
447 #formatOffset(): string {
448 if (this.#offsetSeconds === 0) return "Z";
449
450 const sign = this.#offsetSeconds >= 0 ? "+" : "-";
451 const absSeconds = Math.abs(this.#offsetSeconds);
452 const hours = Math.floor(absSeconds / 3600);
453 const mins = Math.floor((absSeconds % 3600) / 60);
454
455 return `${sign}${String(hours).padStart(2, "0")}:${String(mins).padStart(2, "0")}`;
456 }
457
458 /**
459 * Convert to ISO string with timezone offset.

Callers 1

toStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected