Skip to content

Commit 7074d80

Browse files
committed
Fix
1 parent 09f4faf commit 7074d80

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/commonMain/src/Instant.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public fun Instant.minus(value: Long, unit: DateTimeUnit, timeZone: TimeZone) =
404404
if (value != Long.MIN_VALUE) {
405405
plus(-value, unit, timeZone)
406406
} else {
407-
plus(-(value+1), unit, timeZone).plus(unit, timeZone)
407+
plus(-(value + 1), unit, timeZone).plus(unit, timeZone)
408408
}
409409

410410
/**
@@ -425,7 +425,12 @@ public expect fun Instant.plus(value: Long, unit: DateTimeUnit.TimeBased): Insta
425425
*
426426
* The return value is clamped to the platform-specific boundaries for [Instant] if the result exceeds them.
427427
*/
428-
public fun Instant.minus(value: Long, unit: DateTimeUnit.TimeBased): Instant = plus(-value, unit)
428+
public fun Instant.minus(value: Long, unit: DateTimeUnit.TimeBased): Instant =
429+
if (value != Long.MIN_VALUE) {
430+
plus(-value, unit)
431+
} else {
432+
plus(-(value + 1), unit).plus(unit)
433+
}
429434

430435
/**
431436
* Returns the whole number of the specified date or time [units][unit] between [other] and `this` instants

0 commit comments

Comments
 (0)