Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/common/test/TimeZoneTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class TimeZoneTest {
Pair("Europe/Paris", "Europe/Paris"),
Pair("Europe/Berlin", "Europe/Berlin"),
Pair("Z", "Z"),
Pair("z", "Z"),
Pair("UTC", "UTC"),
Pair("UTC+01:00", "UTC+01:00"),
Pair("GMT+01:00", "GMT+01:00"),
Expand Down
6 changes: 1 addition & 5 deletions core/common/test/format/DateTimeComponentsFormatTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,7 @@ class DateTimeComponentsFormatTest {

@Test
fun testZuluTimeZone() {
// Replace it to:
// listOf("z", "Z").forEach(::assertParseableAsTimeZone)
// when TimeZone.of("z") works correctly
assertParseableAsTimeZone("Z")
assertIncorrectlyParseableAsTimeZone("z")
listOf("z", "Z").forEach(::assertParseableAsTimeZone)
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion core/commonKotlin/src/TimeZone.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public actual open class TimeZone internal constructor() {
if (zoneId == "UTC") {
return UTC
}
if (zoneId == "Z") {
if (zoneId == "Z" || zoneId == "z") {
return UtcOffset.ZERO.asTimeZone()
}
if (zoneId == "SYSTEM") {
Expand Down
2 changes: 1 addition & 1 deletion core/jvm/src/TimeZoneJvm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public actual open class TimeZone internal constructor(internal val zoneId: Zone
FixedOffsetTimeZone(UtcOffset.ZERO, ZoneId.of("UTC"))

public actual fun of(zoneId: String): TimeZone = try {
ofZone(ZoneId.of(zoneId))
ofZone(ZoneId.of(if (zoneId == "z") "Z" else zoneId))
} catch (e: Exception) {
if (e is DateTimeException) throw IllegalTimeZoneException(e)
throw e
Expand Down