https://kotlinlang.org logo
Title
h

Hullaballoonatic

10/31/2019, 4:42 PM
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

gildor

10/31/2019, 4:44 PM
Not yet
But there are plans for kotlinx.time
m

Mike

10/31/2019, 4:45 PM
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

gildor

10/31/2019, 4:45 PM
No, Joda Time is not the best
Better to use ThreeTen-Backport/ThreeTenABP
❤️ 3
👍 5
m

Mike

10/31/2019, 4:48 PM
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

jw

10/31/2019, 5:04 PM
DateTime/LocalDate/LocalDateTime aren't a mess
👍 5
m

Mike

10/31/2019, 5:06 PM
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

Hullaballoonatic

10/31/2019, 5:28 PM
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

Mike

10/31/2019, 5:38 PM
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

Hullaballoonatic

10/31/2019, 10:01 PM
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

gildor

11/01/2019, 12:50 AM
Yeah, let's fix the world to simplify programmer's life, otherwise it would be needed to read documentation for time API
j

jw

11/01/2019, 12:52 AM
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

ghedeon

11/01/2019, 8:01 AM
Didn't they just present library desugaring on dev summit? I'd expect that 310 won't be needed soon.
g

gildor

11/01/2019, 8:02 AM
Yes, in AGP 4.0
h

Hullaballoonatic

11/01/2019, 2:25 PM
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.