Released Klock 1.0: A Date and Time library for Multiplatform Kotlin 1.3

Nov 05 2018

Today I have just released the first version of Klock.

Klock is a Date & Time library for Multiplatform Kotlin 1.3.

It is designed to be as allocation-free as possible using Kotlin inline classes, to be consistent and portable across targets since all the code is written in Common Kotlin, and to provide an API that is powerful, fun and easy to use.

Klock is part of my set of libraries for Kotlin called Korlibs. And it is one of the libraries from the first layer of the stack.

  • Github: https://github.com/korlibs/klock
  • Documentation: https://korlibs.soywiz.com/klock/

A few samples:

val now = DateTime.now()
val duration = 1.seconds
val later = now + 1.months + duration
val is2018Leap = Year(2018).isLeap
val daysInCurrentMonth = now.yearMonth.days
val daysInNextMonth = (now.yearMonth + 1.months).days