fluid-time
Additions for Kotlin's date & time library kotlinx-datetime.
kotlinx-datetime is very early stage and not as actively developed as other official libraries. This library keeps adding missing pieces until the official library catches up.
Installation
build.gradle.kts:
dependencies {
implementation("io.fluidsonic.time:fluid-time:0.12.0")
}
Additions
LocalTime- similar to the existingLocalDateandLocalDateTimeLocalTime.midnight-00:00LocalTime.atDate(LocalDate): LocalDateTime- createLocalDateTimefromLocalDateandLocalTimeLocalDate.atTime(LocalTime): LocalDateTime- createLocalDateTimefromLocalDateandLocalTimeLocalDateTime.time- returns its time components asLocalTimeTimestamp- alias ofInstantfor those who prefer that name (Discussion)(LocalDate|LocalDateTime|LocalTime|Timestamp).parseOrNull(String)- likeparse()but returnsnullinstead of throwingTimeZone.ofOrNull(String)- likeof()but returnsnullinstead of throwing(LocalDate|LocalDateTime|LocalTime|TimeStamp|TimeZone)Serializer- for use withkotlinx-serializationTimestamp.toLocalDate(TimeZone)- shortcut for.toLocalDateTime(timeZone).dateTimestamp.toLocalTime(TimeZone)- shortcut for.toLocalDateTime(timeZone).timeTimestamp.toJavaDate(): Date- converts aTimestamptojava.util.Date(JVM only)ManualClock- aClockimplementation suitable for unit testing- JVM, JS and Darwin are supported.
linuxX64andmingwX64are not supported.
Previous library
Before kotlinx-datetime was released this library has provided its own date & time implementations for JVM and Darwin. That work has been discontinued in favor of using the new official library, even if experimental, with additions provided by this reworked library. Bugfix releases will still be provided if needed.
You can still use the last previous library version 0.10.5.
License
Apache 2.0