I see that kotlin is getting its own implementatio...
# stdlib
h
I see that kotlin is getting its own implementation of
Duration
in the stdlib, and I'm wondering if it could also have its own version of
Date
that cleans up the mess that is Java's
Date
,
DateTime
,
LocalDate
,
LocalDateTime
g
Not yet
But there are plans for kotlinx.time
m
On JDK 8+, use the java.time libraries. They are as clean as time will get. If you're stuck on older version (Android?), then Joda Time is your best alternative.
I hope kotlinx.time just builds on/extends java.time.
g
No, Joda Time is not the best
Better to use ThreeTen-Backport/ThreeTenABP
❤️ 3
👍 5
m
Ahh, yes, I stand corrected. If you can't use java.time, then 310. Fortunately, I've been able to use java.time, so had forgotten 310 was introduced. Thank you
j
DateTime/LocalDate/LocalDateTime aren't a mess
👍 5
m
I agree with Jake, it's the physical Date and Time that are a total mess. Timezones, DST, leap years etc. The java.time library does a very good job of simplifying it as much as possible.
h
By mess I mean that java's
Date
is completely replaced by
LocalDate
,
DateTime
,
LocalDateTime
, which have a worse nomenclature. They could all be consolidated into a single class, imo.
🚫 1
👎 2
m
You've forgotten ZonedDateTime. Time is too complicated to easily be handled by one class. The only time it's easy is if you only have one TZ to deal with, and even that can have complications.
h
Yeah, and don't even start on historical events...
leap seconds...
it would help if we didn't try to divide the time it takes for the earth to orbit the sun by the time it takes for the fully rotate about its axis, given those two cosmological events have no relation to one another at all
g
Yeah, let's fix the world to simplify programmer's life, otherwise it would be needed to read documentation for time API
j
Well... timezones and DST aren't really needed anymore. Leap seconds then also not needed. We control the software, people. Let's do this.
🗺️ 2
g
Didn't they just present library desugaring on dev summit? I'd expect that 310 won't be needed soon.
g
Yes, in AGP 4.0
h
I'm all for a hard-reset on humanity so we can start this whole quantifying date/time thing from a more sensible position. At the moment, it is un-refactorable.