@@ -169,7 +169,7 @@ public actual fun Instant.plus(period: DateTimePeriod, timeZone: TimeZone): Inst
169169 val newLdt = toLocalDateTimeFailing(initialOffset)
170170 .run { if (totalMonths != 0 ) { plus(totalMonths, DateTimeUnit .MONTH ) } else { this } }
171171 .run { if (days != 0 ) { plus(days, DateTimeUnit .DAY ) } else { this } }
172- timeZone.atZone (newLdt, preferred = initialOffset).toInstant( )
172+ timeZone.localDateTimeToInstant (newLdt, preferred = initialOffset)
173173 .run { if (totalNanoseconds != 0L ) plus(0 , totalNanoseconds).check(timeZone) else this }
174174 }.check(timeZone)
175175} catch (e: ArithmeticException ) {
@@ -192,7 +192,7 @@ public actual fun Instant.plus(value: Long, unit: DateTimeUnit, timeZone: TimeZo
192192 throw ArithmeticException (" Can't add a Long date-based value, as it would cause an overflow" )
193193 val initialOffset = offsetIn(timeZone)
194194 val initialLdt = toLocalDateTimeFailing(initialOffset)
195- timeZone.atZone (initialLdt.plus(value.toInt(), unit), preferred = initialOffset).toInstant( )
195+ timeZone.localDateTimeToInstant (initialLdt.plus(value.toInt(), unit), preferred = initialOffset)
196196 }
197197 is DateTimeUnit .TimeBased ->
198198 check(timeZone).plus(value, unit).check(timeZone)
@@ -222,7 +222,7 @@ public actual fun Instant.periodUntil(other: Instant, timeZone: TimeZone): DateT
222222 val months = initialLdt.until(otherLdt, DateTimeUnit .MONTH ).toLong().toInt() // `until` on dates never fails
223223 val ldtWithMonths = initialLdt.plus(months, DateTimeUnit .MONTH ) // won't throw: thisLdt + months <= otherLdt, which is known to be valid
224224 val days = ldtWithMonths.until(otherLdt, DateTimeUnit .DAY ).toLong().toInt() // `until` on dates never fails
225- val newInstant = timeZone.atZone (ldtWithMonths.plus(days, DateTimeUnit .DAY ), preferred = initialOffset).toInstant( ) // won't throw: thisLdt + days <= otherLdt
225+ val newInstant = timeZone.localDateTimeToInstant (ldtWithMonths.plus(days, DateTimeUnit .DAY ), preferred = initialOffset) // won't throw: thisLdt + days <= otherLdt
226226 val nanoseconds = newInstant.until(other, DateTimeUnit .NANOSECOND ) // |otherLdt - thisLdt| < 24h
227227
228228 return buildDateTimePeriod(months, days, nanoseconds)
0 commit comments