/ Calendars

A Date & Time library for Multiplatform Kotlin

A Date & Time library for Multiplatform Kotlin


Date and time utilities for Multiplatform Kotlin 1.3: consistent and portable. JVM, JS, Native and Common.

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.

Some 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

Usage with gradle:

def klockVersion = "1.0.0"

repositories {
    maven { url "https://dl.bintray.com/soywiz/soywiz" }

// For multiplatform projects
implementation "com.soywiz:klock:$klockVersion"