Open
Description
Almost equivalent to #484, but more pronounced.
From the documentation:
Returns the whole number of the specified date or time units between this and other instants in the specified timeZone.
This is not true: "the whole number" implies "the number rounded towards zero to the nearest whole number", but that's not what we get:
import kotlinx.datetime.*
fun main() {
val tz = TimeZone.of("Europe/Berlin")
val i1 = LocalDateTime(2025, 3, 29, 2, 30).toInstant(tz)
val i2 = LocalDateTime(2025, 3, 30, 3, 10).toInstant(tz)
println(i2 - i1.plus(i1.until(i2, DateTimeUnit.DAY, tz), DateTimeUnit.DAY, tz)) // -20m
}
b - (a + floor(b - a))
should be non-negative for positive b
and a
, but here, it's not.