@@ -12,13 +12,11 @@ import kotlinx.datetime.internal.*
12
12
import kotlinx.datetime.serializers.InstantIso8601Serializer
13
13
import kotlinx.serialization.Serializable
14
14
import java.time.DateTimeException
15
- import java.time.format.*
16
15
import java.time.temporal.*
17
16
import kotlin.time.*
18
17
import kotlin.time.Duration.Companion.nanoseconds
19
18
import kotlin.time.Duration.Companion.seconds
20
19
import java.time.Instant as jtInstant
21
- import java.time.OffsetDateTime as jtOffsetDateTime
22
20
import java.time.Clock as jtClock
23
21
24
22
@Serializable(with = InstantIso8601Serializer ::class )
@@ -83,17 +81,6 @@ public actual class Instant internal constructor(internal val value: jtInstant)
83
81
@Deprecated(" This overload is only kept for binary compatibility" , level = DeprecationLevel .HIDDEN )
84
82
public fun parse (isoString : String ): Instant = parse(input = isoString)
85
83
86
- /* * A workaround for a quirk of the JDKs older than 11 where the string representations of Instant that have an
87
- * offset of the form "+XX" are not recognized by [jtOffsetDateTime.parse], while "+XX:XX" work fine. */
88
- private fun fixOffsetRepresentation (isoString : CharSequence ): CharSequence {
89
- val time = isoString.indexOf(' T' , ignoreCase = true )
90
- if (time == - 1 ) return isoString // the string is malformed
91
- val offset = isoString.indexOfLast { c -> c == ' +' || c == ' -' }
92
- if (offset < time) return isoString // the offset is 'Z' and not +/- something else
93
- val separator = isoString.indexOf(' :' , offset) // if there is a ':' in the offset, no changes needed
94
- return if (separator != - 1 ) isoString else " $isoString :00"
95
- }
96
-
97
84
public actual fun fromEpochSeconds (epochSeconds : Long , nanosecondAdjustment : Long ): Instant = try {
98
85
Instant (jtInstant.ofEpochSecond(epochSeconds, nanosecondAdjustment))
99
86
} catch (e: Exception ) {
0 commit comments