File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public actual open class TimeZone internal constructor(internal val zoneId: Zone
4444 internal fun ofZone (zoneId : ZoneId ): TimeZone = when {
4545 zoneId is jtZoneOffset ->
4646 FixedOffsetTimeZone (UtcOffset (zoneId))
47- zoneId.rules. isFixedOffset ->
47+ zoneId.isFixedOffset ->
4848 FixedOffsetTimeZone (UtcOffset (zoneId.normalized() as jtZoneOffset), zoneId)
4949 else ->
5050 TimeZone (zoneId)
@@ -54,6 +54,15 @@ public actual open class TimeZone internal constructor(internal val zoneId: Zone
5454 }
5555}
5656
57+ // Workaround for https://issuetracker.google.com/issues/203956057
58+ private val ZoneId .isFixedOffset: Boolean
59+ get() = try {
60+ // On older Android versions, this can throw even though it shouldn't
61+ rules.isFixedOffset
62+ } catch (e: ArrayIndexOutOfBoundsException ) {
63+ false // Happens for America/Costa_Rica, Africa/Cairo, Egypt
64+ }
65+
5766@Serializable(with = FixedOffsetTimeZoneSerializer ::class )
5867public actual class FixedOffsetTimeZone
5968internal constructor (public actual val offset: UtcOffset , zoneId: ZoneId ): TimeZone (zoneId) {
You can’t perform that action at this time.
0 commit comments