File tree 1 file changed +10
-1
lines changed
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
44
44
internal fun ofZone (zoneId : ZoneId ): TimeZone = when {
45
45
zoneId is jtZoneOffset ->
46
46
FixedOffsetTimeZone (UtcOffset (zoneId))
47
- zoneId.rules. isFixedOffset ->
47
+ zoneId.isFixedOffset ->
48
48
FixedOffsetTimeZone (UtcOffset (zoneId.normalized() as jtZoneOffset), zoneId)
49
49
else ->
50
50
TimeZone (zoneId)
@@ -54,6 +54,15 @@ public actual open class TimeZone internal constructor(internal val zoneId: Zone
54
54
}
55
55
}
56
56
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
+
57
66
@Serializable(with = FixedOffsetTimeZoneSerializer ::class )
58
67
public actual class FixedOffsetTimeZone
59
68
internal constructor (public actual val offset: UtcOffset , zoneId: ZoneId ): TimeZone (zoneId) {
You can’t perform that action at this time.
0 commit comments