
Enhances the date and time library with additional features like custom duration creation, safe parsing methods, timestamp conversions, and utilities for handling time zones and leap years.
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.
build.gradle.kts:
dependencies {
implementation("io.fluidsonic.time:fluid-time:0.18.0")
}Clock.toJavaClock(TimeZone) – wraps a Clock into a java.time.Clock (JVM only)Duration(days, hours, minutes, seconds, nanoseconds) – Duration factory function using componentsDurationSerializer - kotlinx-serialization serializer for Duration
LocalDateOrNull(year, month, day) - like LocalDate() but returns null instead of throwingLocalTime.max - 23:59:59.999999999
LocalTime.midnight - 00:00
LocalTime.min - 00:00
Timestamp - alias of Instant for those who prefer that name (Discussion)(LocalDate|LocalDateTime|LocalTime|Timestamp).parseOrNull(String) - like parse() but returns null instead of throwingTimeZone.ofOrNull(String) - like of() but returns null instead of throwingTimestamp.durationSince(Timestamp)/.durationUntil(Timestamp) - get Duration between two timestampsTimestamp.toLocalDate(TimeZone) - shortcut for .toLocalDateTime(timeZone).date
Timestamp.toLocalTime(TimeZone) - shortcut for .toLocalDateTime(timeZone).time
Timestamp.toJavaDate(): Date - converts a Timestamp to java.util.Date (JVM only)Month.daysIn(year) - number of days in a given month and yearYear.isLeap(year) - whether a year is a leap yearManualClock - a Clock implementation suitable for unit testinglinuxX64 and mingwX64 are not supported.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.
Apache 2.0
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.
build.gradle.kts:
dependencies {
implementation("io.fluidsonic.time:fluid-time:0.18.0")
}Clock.toJavaClock(TimeZone) – wraps a Clock into a java.time.Clock (JVM only)Duration(days, hours, minutes, seconds, nanoseconds) – Duration factory function using componentsDurationSerializer - kotlinx-serialization serializer for Duration
LocalDateOrNull(year, month, day) - like LocalDate() but returns null instead of throwingLocalTime.max - 23:59:59.999999999
LocalTime.midnight - 00:00
LocalTime.min - 00:00
Timestamp - alias of Instant for those who prefer that name (Discussion)(LocalDate|LocalDateTime|LocalTime|Timestamp).parseOrNull(String) - like parse() but returns null instead of throwingTimeZone.ofOrNull(String) - like of() but returns null instead of throwingTimestamp.durationSince(Timestamp)/.durationUntil(Timestamp) - get Duration between two timestampsTimestamp.toLocalDate(TimeZone) - shortcut for .toLocalDateTime(timeZone).date
Timestamp.toLocalTime(TimeZone) - shortcut for .toLocalDateTime(timeZone).time
Timestamp.toJavaDate(): Date - converts a Timestamp to java.util.Date (JVM only)Month.daysIn(year) - number of days in a given month and yearYear.isLeap(year) - whether a year is a leap yearManualClock - a Clock implementation suitable for unit testinglinuxX64 and mingwX64 are not supported.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.
Apache 2.0