Skip to content

Commit c17c491

Browse files
TimeZone.of("z") should work the same as calling from capital "Z" #529
1 parent 4dadf6f commit c17c491

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

core/common/test/TimeZoneTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ class TimeZoneTest {
111111
Pair("Europe/Paris", "Europe/Paris"),
112112
Pair("Europe/Berlin", "Europe/Berlin"),
113113
Pair("Z", "Z"),
114+
Pair("z", "Z"),
114115
Pair("UTC", "UTC"),
115116
Pair("UTC+01:00", "UTC+01:00"),
116117
Pair("GMT+01:00", "GMT+01:00"),

core/commonKotlin/src/TimeZone.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public actual open class TimeZone internal constructor() {
3232
if (zoneId == "UTC") {
3333
return UTC
3434
}
35-
if (zoneId == "Z") {
35+
if (zoneId == "Z" || zoneId == "z") {
3636
return UtcOffset.ZERO.asTimeZone()
3737
}
3838
if (zoneId == "SYSTEM") {

core/jvm/src/TimeZoneJvm.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public actual open class TimeZone internal constructor(internal val zoneId: Zone
3636
FixedOffsetTimeZone(UtcOffset.ZERO, ZoneId.of("UTC"))
3737

3838
public actual fun of(zoneId: String): TimeZone = try {
39-
ofZone(ZoneId.of(zoneId))
39+
ofZone(ZoneId.of(if (zoneId == "z") "Z" else zoneId))
4040
} catch (e: Exception) {
4141
if (e is DateTimeException) throw IllegalTimeZoneException(e)
4242
throw e

0 commit comments

Comments
 (0)