
Cross-platform date and time utilities offering unified API, localization, and time zone support with easy integration and idiomatic practices for modern applications.
A Kotlin Multiplatform library for date and time utilities, designed for modern applications. The library supports multiple platforms including Android, JVM, iOS, JavaScript, and WebAssembly.
Here's a comprehensive guide on how to include kDateTimeX for each supported platform in your Kotlin Multiplatform project. The library is published under the namespace dev.sunnat629 on Maven Central.
To add the library for all platforms, include the following in your commonMain source set:
// Root build.gradle.kts
repositories {
mavenCentral()
}
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("dev.sunnat629:kDateTimeX:$lib_version")
}
}
}
}If you want to include the library only for specific platforms, use the following configuration.
androidMain {
dependencies {
implementation("dev.sunnat629:kDateTimeX-android:$lib_version")
}
}jvmMain {
dependencies {
implementation("dev.sunnat629:kDateTimeX-jvm:$lib_version")
}
}jsMain {
dependencies {
implementation("dev.sunnat629:kDateTimeX-js:$lib_version")
}
}iosArm64Main {
dependencies {
implementation("dev.sunnat629:kDateTimeX-ios:$lib_version")
}
}
iosX64Main {
dependencies {
implementation("dev.sunnat629:kDateTimeX-ios:$lib_version")
}
}
iosSimulatorArm64Main {
dependencies {
implementation("dev.sunnat629:kDateTimeX-ios:$lib_version")
}
}wasmMain {
dependencies {
implementation("dev.sunnat629:kDateTimeX-wasm-js:$lib_version")
}
}| Platform | Artifact ID | Example Dependency |
|---|---|---|
| Common | kDateTimeX |
implementation("dev.sunnat629:kDateTimeX:$lib_version") |
| Android | kDateTimeX-android |
implementation("dev.sunnat629:kDateTimeX-android:$lib_version") |
| JVM | kDateTimeX-jvm |
implementation("dev.sunnat629:kDateTimeX-jvm:$lib_version") |
| JavaScript | kDateTimeX-js |
implementation("dev.sunnat629:kDateTimeX-js:$lib_version") |
| iOS | kDateTimeX-ios |
implementation("dev.sunnat629:kDateTimeX-ios:$lib_version") |
| WASM | kDateTimeX-wasm-js |
implementation("dev.sunnat629:kDateTimeX-wasm-js:$lib_version") |
Note: In the current version (
1.0.0), there are no specific platform-dependent implementations. All the utility functions are part of the Common module, so using the common dependency (kDateTimeX) is sufficient for all platforms. Separate platform artifacts are provided for compatibility with Kotlin Multiplatform's dependency management, but they do not contain unique platform-specific code.
mavenCentral() added to your repositories in the root build.gradle.kts.kDateTimeX includes shared utilities for all platforms.import dev.sunnat629.libs.kdatetimex.*
val epochSeconds = 1731186379L
val formattedDate = epochSeconds.toLocalDateTime().toHumanReadableString()
println("Formatted Date: $formattedDate")val isLeapYear = isLeapYear(2024)
println("Is 2024 a leap year? $isLeapYear")
val currentInstant = getNowInInstant()
println("Current Time: $currentInstant")val timestamp = 1672531199L
val humanReadableTime = formatMillisecondsToHumanTime(timestamp * 1000)
println("Human Readable Time: $humanReadableTime")Detailed documentation and examples are available in the Wiki.
See the Changelog for recent changes and updates.
We welcome contributions! Please read our Contributing Guide for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or support, reach out to Mohi Us Sunnat.
A Kotlin Multiplatform library for date and time utilities, designed for modern applications. The library supports multiple platforms including Android, JVM, iOS, JavaScript, and WebAssembly.
Here's a comprehensive guide on how to include kDateTimeX for each supported platform in your Kotlin Multiplatform project. The library is published under the namespace dev.sunnat629 on Maven Central.
To add the library for all platforms, include the following in your commonMain source set:
// Root build.gradle.kts
repositories {
mavenCentral()
}
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("dev.sunnat629:kDateTimeX:$lib_version")
}
}
}
}If you want to include the library only for specific platforms, use the following configuration.
androidMain {
dependencies {
implementation("dev.sunnat629:kDateTimeX-android:$lib_version")
}
}jvmMain {
dependencies {
implementation("dev.sunnat629:kDateTimeX-jvm:$lib_version")
}
}jsMain {
dependencies {
implementation("dev.sunnat629:kDateTimeX-js:$lib_version")
}
}iosArm64Main {
dependencies {
implementation("dev.sunnat629:kDateTimeX-ios:$lib_version")
}
}
iosX64Main {
dependencies {
implementation("dev.sunnat629:kDateTimeX-ios:$lib_version")
}
}
iosSimulatorArm64Main {
dependencies {
implementation("dev.sunnat629:kDateTimeX-ios:$lib_version")
}
}wasmMain {
dependencies {
implementation("dev.sunnat629:kDateTimeX-wasm-js:$lib_version")
}
}| Platform | Artifact ID | Example Dependency |
|---|---|---|
| Common | kDateTimeX |
implementation("dev.sunnat629:kDateTimeX:$lib_version") |
| Android | kDateTimeX-android |
implementation("dev.sunnat629:kDateTimeX-android:$lib_version") |
| JVM | kDateTimeX-jvm |
implementation("dev.sunnat629:kDateTimeX-jvm:$lib_version") |
| JavaScript | kDateTimeX-js |
implementation("dev.sunnat629:kDateTimeX-js:$lib_version") |
| iOS | kDateTimeX-ios |
implementation("dev.sunnat629:kDateTimeX-ios:$lib_version") |
| WASM | kDateTimeX-wasm-js |
implementation("dev.sunnat629:kDateTimeX-wasm-js:$lib_version") |
Note: In the current version (
1.0.0), there are no specific platform-dependent implementations. All the utility functions are part of the Common module, so using the common dependency (kDateTimeX) is sufficient for all platforms. Separate platform artifacts are provided for compatibility with Kotlin Multiplatform's dependency management, but they do not contain unique platform-specific code.
mavenCentral() added to your repositories in the root build.gradle.kts.kDateTimeX includes shared utilities for all platforms.import dev.sunnat629.libs.kdatetimex.*
val epochSeconds = 1731186379L
val formattedDate = epochSeconds.toLocalDateTime().toHumanReadableString()
println("Formatted Date: $formattedDate")val isLeapYear = isLeapYear(2024)
println("Is 2024 a leap year? $isLeapYear")
val currentInstant = getNowInInstant()
println("Current Time: $currentInstant")val timestamp = 1672531199L
val humanReadableTime = formatMillisecondsToHumanTime(timestamp * 1000)
println("Human Readable Time: $humanReadableTime")Detailed documentation and examples are available in the Wiki.
See the Changelog for recent changes and updates.
We welcome contributions! Please read our Contributing Guide for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or support, reach out to Mohi Us Sunnat.