Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken guarantee in Instant.periodUntil #484

Open
dkhalanskyjb opened this issue Feb 13, 2025 · 0 comments
Open

Broken guarantee in Instant.periodUntil #484

dkhalanskyjb opened this issue Feb 13, 2025 · 0 comments

Comments

@dkhalanskyjb
Copy link
Collaborator

dkhalanskyjb commented Feb 13, 2025

Quoting https://kotlinlang.org/api/kotlinx-datetime/kotlinx-datetime/kotlinx.datetime/period-until.html:

All components of the DateTimePeriod returned are [...] positive or zero if this instant is earlier than the other.

val tz = TimeZone.of("Europe/Berlin")
println(
    LocalDateTime(2025, 3, 29, 2, 30).toInstant(tz).periodUntil(
    LocalDateTime(2025, 3, 30, 3, 10).toInstant(tz), tz))
// P1DT-20M

Runnable: https://pl.kotl.in/LedZ6Njqf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant