* Convert to ISO string with timezone.
()
| 983 | * Convert to ISO string with timezone. |
| 984 | */ |
| 985 | public toString(): string { |
| 986 | const y = String(this.#year).padStart(4, "0"); |
| 987 | const mo = String(this.#month).padStart(2, "0"); |
| 988 | const d = String(this.#day).padStart(2, "0"); |
| 989 | const h = String(this.#hour).padStart(2, "0"); |
| 990 | const mi = String(this.#minute).padStart(2, "0"); |
| 991 | const s = String(this.#second).padStart(2, "0"); |
| 992 | |
| 993 | let result = `${y}-${mo}-${d}T${h}:${mi}:${s}`; |
| 994 | if (this.#nanosecond > 0) { |
| 995 | let nanos = String(this.#nanosecond).padStart(9, "0"); |
| 996 | nanos = nanos.replace(/0+$/, ""); |
| 997 | result += `.${nanos}`; |
| 998 | } |
| 999 | |
| 1000 | result += this.#formatOffset(); |
| 1001 | |
| 1002 | if (this.#timezone) { |
| 1003 | result += `[${this.#timezone}]`; |
| 1004 | } |
| 1005 | |
| 1006 | return result; |
| 1007 | } |
| 1008 | |
| 1009 | public compareTo(other: DateTimeValue): number { |
| 1010 | // Compare by UTC instant |
nothing calls this directly
no test coverage detected