* Format timezone offset as +HH:MM or -HH:MM.
()
| 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. |