I'm looking for an exhaustive list of why using ko...
# kotlinx-datetime
r
I'm looking for an exhaustive list of why using kotlinx.datetime instead of java.time api. • Multi-platform? • TZ Data up-to-date ? Edit:Decoupled from language release
k
Natively serializable by kotlinx serialization
k
Does it use tzdata now? Used to not...
r
True, so how can we get an up-to-date timezone dataset then?
k
That's why we use threetenabp on Android...
r
But ThreeTenAbp says:
Attention: Development on this library is winding down. Please consider switching to Android Gradle plugin 4.0,
java.time.*
, and its core library desugaring feature in the coming months.
So basically saying: "use java.time", right?
But
kotlinx.datatime
uses
java.time
under the wood or I am missing something?
To update
java.time
, this library was developped https://github.com/ZacSweers/ticktock
k
Yep, on Android at least, just use the desugaring libs
r
What do you think make the kotlinx.datetime library useful then?
k
MPP is the biggest one for me with serialization in a close second
If you’re doing Android only then it’s not worth the dep. There will be more samples online for java time than kotlinx
It would be fantastic if it had a way to natively update tz info, but I suppose that’s less of a concern with kotlinx since it’s decoupled from the language
m
+1 on MPP. Also usage is a bit more idiomatic if you're used to Kotlin and extension functions:
Copy code
// kotlinx
someIsoStr.toLocalDateTime().date
vs
Copy code
// java.time
LocalDateTime.parse(someIsoStr).toLocalDate()
k
The more I think about it the more I also like that it's decoupled from the language release cadence
r
That's a valid point indeed