Skip to content

feat!: migrate public time API to kotlin.time#100

Open
juherr wants to merge 1 commit into
IZIVIA:devfrom
juherr:feat/kotlin-time-api
Open

feat!: migrate public time API to kotlin.time#100
juherr wants to merge 1 commit into
IZIVIA:devfrom
juherr:feat/kotlin-time-api

Conversation

@juherr

@juherr juherr commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

fix #99

Migrates the public time API from kotlinx.datetime to kotlin.time.

This is a breaking change: public model constructors, properties, and JVM signatures now expose kotlin.time.Instant / kotlin.time.Clock instead of kotlinx.datetime.Instant / kotlinx.datetime.Clock.

Changes

  • Replace public kotlinx.datetime.Instant and Clock usage with kotlin.time.Instant and Clock
  • Raise Kotlin apiVersion / languageVersion to KOTLIN_2_3
  • Remove kotlinx-datetime from main module dependencies where no longer needed
  • Replace KotlinxInstantModule with KotlinInstantModule
  • Keep a deprecated KotlinxInstantModule alias for source migration
  • Preserve Jackson ISO-8601 serialization with millisecond truncation
  • Add tolerant inbound timestamp parsing for OCPP interoperability:
    • canonical Z
    • full offsets such as +02:00
    • incomplete offsets such as +02, with a warning
    • timestamps without timezone, interpreted as UTC with a warning
  • Keep outbound timestamps canonical
  • Update tests and consumer compatibility coverage

Breaking Changes

  • Public APIs now require Kotlin standard library time types:
    • kotlin.time.Instant
    • kotlin.time.Clock
  • Consumers using kotlinx.datetime.Instant must migrate call sites to kotlin.time.Instant.

Notes

The timestamp deserialization follows the interop-oriented approach discussed by SteVe/Monta maintainers: consume broadly for real-world charge point compatibility, but produce one canonical format.

References:

Verification

  • ./gradlew :toolkit:test --tests 'com.izivia.ocpp.utils.KotlinInstantModuleTest'
  • ./gradlew test
  • ./gradlew publishToMavenLocal
  • Local consumer test against the published artifact with kotlinx-datetime:0.8.0

@sonarqubecloud

Copy link
Copy Markdown

@juherr
juherr marked this pull request as ready for review July 10, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate public time API away from deprecated kotlinx.datetime types

1 participant