-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Milestone
Description
(If this is a duplicate issue, apologies. I didn't spot it.)
To aid in migration from JDK's datetime API to kotlinx-datetime, shims would be helpful. An example:
/** Shim for compatibility with JDK's `Instant` */
public fun Instant.minusSeconds(seconds: Long): Instant =
this - Duration.seconds(seconds)
This example gives the same API call for kotlinx-datetime Instant
as for JDK's Instant
class. I stumbled on this while migrating a project from JDK's API to kotlinx-datetime. These kind of shims are helpful to encourage migration, and make it more painless. An ideal situation would be just:
- Update the build dependencies
- Update the import statements in Kotlin source files
Were the shims in a separate dependency, that would be just as simple (only step # 1 changes) if that were better aligned with project goals.
farmerbb
Metadata
Metadata
Assignees
Labels
No labels