russhwolf
01/12/2025, 1:17 AMTimeZone.UTC
is not equivalent to TimeZone.of("UTC")
? That's incredibly unintuitive.kevin.cianfarini
01/12/2025, 1:32 AMrusshwolf
01/12/2025, 1:40 AMTimeZone.of("UTC")
is not equal to TimeZone.UTC
.russhwolf
01/12/2025, 1:41 AMkevin.cianfarini
01/12/2025, 1:55 AM.of("UTC")
and .UTC
are not equal.kevin.cianfarini
01/12/2025, 1:55 AMkevin.cianfarini
01/12/2025, 1:55 AMFixedOffsetTimeZone
that UtcOffset doesn't cover 🙃russhwolf
01/12/2025, 2:20 AMDaniel Pitts
01/12/2025, 9:04 PM.of("Z")
will be the same as .UTC
, but GMT/UTC/UT are handled differently:
if (zoneId == "UTC" || zoneId == "GMT" || zoneId == "UT") {
return FixedOffsetTimeZone(UtcOffset.ZERO, zoneId)
}
Daniel Pitts
01/12/2025, 9:11 PMZ
vs UTC
being equivalent:
actual override fun equals(other: Any?): Boolean =
this === other || other is TimeZone && this.id == other.id
override fun hashCode(): Int = id.hashCode()
Daniel Pitts
01/12/2025, 9:17 PMpublic actual val ZERO: UtcOffset = UtcOffset(ZoneOffset.UTC)
and
actual override fun toString(): String = zoneOffset.toString()
ZoneOffset is a Java class, and its toString
will return Z
for the zero offset, or will return the [-|+]hh:mm:ss
(optional seconds) based on the offset.kevin.cianfarini
01/28/2025, 3:20 PM