Popularity
0.5
Declining
Activity
0.0
Stable
5
1
0

Programming language: Kotlin
License: Apache License 2.0
Tags: Misc    
Latest version: v0.1.0

kxjtime alternatives and similar libraries

Based on the "Misc" category.
Alternatively, view kxjtime alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of kxjtime or a related project?

Add another 'Misc' Library

README

Maven Central pipeline status Build Status

KxjTime

KxjTime is a micro library that provides a convenient way to create java.time API objects.

Usage

Simplify creation of various objects from java.time API.

Extensions for Integers and Longs

Create Duration from Integers

val thirtyMinutes = 30.minutes
val twoMilliseconds = 2.milliseconds

Which can be then combined by Kotlin overloaded operators or with infix and

val duration1 = 10.days + 1.hours + 5.minutes + 3.seconds
val duration2 = 10.days and 1.hours and 5.minutes and 3.seconds

Natural language

Combine Duration with Time-based classes

val createdAt = 10.days and 1.hours and 5.minutes before ZonedDateTime.now()
val willDoSomethingAt = 30.minutes + 10.seconds + 3.hours after Instant.now()

Readable and concise code

if (createdAt.isBefore(30.minutes + 10.seconds + 3.hours after now)) {
    // do something
}
if (now.isAfter(12.hours after scheduledTime)) {
    // do something later
}