Matas Lauzadis
12/19/2024, 11:13 PM23:59:60) which needs to subtract one second (becoming 23:59:59). I have a function: private fun WithTime.secondOrleapSecond() = alternativeParsing({ second() }) { chars("60") } . This can parse the leap seconds without crashing, but (understandably) returns 23:59:0 . How can I set seconds = 59 in this case? I found a GitHub issue about leap seconds, there was a hint of a solution but none offered.russhwolf
01/12/2025, 1:17 AMTimeZone.UTC is not equivalent to TimeZone.of("UTC")? That's incredibly unintuitive.kevin.cianfarini
01/15/2025, 7:23 PMrob42
01/17/2025, 3:26 PMdave08
01/20/2025, 11:53 AMCLOVIS
02/05/2025, 4:58 PMOk, but, how?is a subclass ofDatePeriodwith zero time components, it represents a difference between two LocalDate values decomposed into date units.DateTimePeriod
LocalDate doesn't have a - operator 🤔CLOVIS
02/05/2025, 5:05 PMUtcOffset doesn't internally rely on Duration ? Looking at the code, my guess is that it was to rely on Java's implementation?hfhbd
02/06/2025, 9:15 AMDmitry Khalanskiy [JB]
02/10/2025, 3:41 PMdawidhyzy
02/17/2025, 8:32 AMpeekandpoke
03/03/2025, 9:30 AMcurioustechizen
03/17/2025, 1:56 PMStylianos Gakis
03/24/2025, 4:05 PM2025-03-24T08:00:00.000001Z
Which indicates that it's in UTC time, hence the Z afaik
But I may get an instant which is not Z there, but some other timezone too
Is there a way for me to turn it into a LocalDateTime, but using whatever time-zone the string itself already came in?
So I want to do
Instant
.parse("2025-03-24T08:00:00.000001Z")
.toLocalDateTime(???)
But not sure what I should do for timezone.
The use-case is that my server is giving me a timestamp, and I want to show the date only as-is, so whatever the server had decided already. So if you are in different parts of the world you do not get different results (if I used TimeZone.currentSystemDefault()) but I also don't want to just default to UTC and potentially change the date that I show if the timestamp was not in UTC.Manuel Lorenzo
03/28/2025, 8:06 PMKotlinx_datetimeLocalDateTimeRobert Jaros
04/14/2025, 12:29 PMkotlinx-datetime on Kotlin/JS on Windows I have a strange problem with casing. There is a webpack warning and the library is not working correctly (ClassCastException is thrown):
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
javascript/esm|C:\Users\kpadarz\Desktop\Wykaz\wykaz2\wykaz\build\js\packages\wykaz\kotlin\Kotlin-DateTime-library-kotlinx-datetime\kotlinx\datetime\serializers\LocalTimeSerializers.mjs Used by 1 module(s), i. e. javascript/esm|C:\Users\kpadarz\Desktop\Wykaz\wykaz2\wykaz\build\js\packages\wykaz\kotlin\Kotlin-DateTime-library-kotlinx-datetime\kotlinx\datetime\localtime.mjs
javascript/esm|C:\Users\kpadarz\Desktop\Wykaz\wykaz2\wykaz\build\js\packages\wykaz\kotlin\kotlin-datetime-library-kotlinx-datetime\kotlinx\datetime\serializers\LocalTimeSerializers.mjs Used by 1 module(s), i. e. javascript/esm|C:\Users\kpadarz\Desktop\Wykaz\wykaz2\wykaz\build\js\packages\wykaz\kotlin\kotlin-datetime-library-kotlinx-datetime\kotlinx\datetime\localtime.mjskevin.cianfarini
04/29/2025, 1:20 PMval min = LocalTime(hour = 0, minute = 0, second = 0, nanosecond = 0)
val max = LocalTime(hour = 23, minute = 59, second = 59, nanosecond = 999_999_999)
Would there be any interest in accepting a PR that specifies LocalTime.MIN and LocalTime.MAX like both Instant and LocalDateTime have?kevin.cianfarini
04/29/2025, 3:19 PMkotlinx.datetime.TimeZone shouldn’t query the underlying database from the tzdb entry when calling TimeZone.of(String). Do you have thoughts?kevin.cianfarini
05/07/2025, 6:43 PMkotlinx.datetime.Clock. I suspect I should move those to kotlin.time.Clock? When is kotlinx.datetime.Clock planned to be removed?Smoothie
05/26/2025, 9:22 AMDmitry Khalanskiy [JB]
06/24/2025, 2:53 PMkotlinx-datetime 0.7.0 is here!
• Instant and Clock were moved to the standard library and are no longer part of kotlinx-datetime. Please follow https://github.com/Kotlin/kotlinx-datetime?tab=readme-ov-file#deprecation-of-instant if you encounter problems because of that.
• LocalDateRange, a range of date values, was added.
• YearMonth and YearMonthRange were added.
• Serializers that can be parameterized with a DateTimeFormat were added.
• Most entities in the library are java.io.Serializable now.
• Other changes. The full changelog is available here: https://github.com/Kotlin/kotlinx-datetime/releases/tag/v0.7.0Dmitry Khalanskiy [JB]
06/30/2025, 11:46 AMkotlinx-datetime 0.6.2 or earlier, and are also
2. Planning on upgrading to kotlinx-datetime 0.7.0, but haven't yet,
then you are advised to wait until 0.7.1 comes out in the next few days.
0.7.0 is missing some migration assistance, namely the deprecated-with-warning type aliases kotlinx.datetime.Instant = kotlin.time.Instant and kotlinx.datetime.Clock = kotlin.time.Clock (https://github.com/Kotlin/kotlinx-datetime/pull/540/commits/f829958a1bcbe7b24a11a91519cf57aaf3daa74b). Without them, your client code will not compile until you replace the usages manually, whereas with them, you will be able to proceed at your own pace (if you are not using libraries that themselves depend on kotlinx.datetime.Instant) or even perform automatic replacement with the help of an IDE.
This is a glaring omission that I made when publishing the release, and I am sorry about that. The type aliases in 0.7.0 were planned from the beginning, but due to my oversight, were missing from the release.Dmitry Khalanskiy [JB]
07/07/2025, 6:04 PMkotlinx-datetime 0.7.1 is here, providing a more convenient migration path to kotlin.time.Instant!
https://github.com/Kotlin/kotlinx-datetime/releases/tag/v0.7.1ursus
07/13/2025, 1:45 AMjava.time has)?curioustechizen
07/18/2025, 1:25 PMkotlin.time.Instant and kotlin.time.Clock were introduced in Kotlin 2.1.20
Then, kotlinx.serialization added support for these 2 types in v1.9.0, but that requires Kotlin 2.2
What are my options if I want to stay on Kotlin 2.1.20 and want to serialize kotlin.time.Instant types? Is the compat artifact useful for this situation?curioustechizen
07/21/2025, 11:05 AMkotlinx.datetime.Instant would be visible to iOS as Kotlinx_datetimeInstant
Since it is moved to the stdlib, what should it be exported as? Kotlin_timeInstant is not found, neither is just Instant.Dmitry Khalanskiy [JB]
07/30/2025, 2:23 PM@Serializable annotation from TimeZone and FixedOffsetTimeZone in the future and deprecate the serializers for these classes. Please restructure your code to send and receive the timezone identifier (timeZone.id, converted back to the timezone with TimeZone.of(id)) instead of the timezone itself.
The reason for this change is that the timezone database used in the code performing the deserialization can be different from the one that was used for serialization. This may even lead to crashes if the deserializing side does not know the serialized timezone identifier. The explicit need to call TimeZone.of on the deserialization result gives a more controlled environment for handling the failure and demonstrates the risk better.Filipp Zhinkin
08/15/2025, 5:41 PMkotlin.time.Instant and kotlin.time.Clock stabilization in Kotlin 2.3, so if there was anything with them that you wanted to change, it's time to let us know: https://kotlinlang.slack.com/archives/C0B8Q383C/p1755279531599069Emre
09/09/2025, 10:13 PMInstantSerialized::class.java because I use kotlin.time.Instant in a data class but I can't because InstantSerialized is private. I did not have this problem with kotlinx-datetime.Bradleycorn
10/03/2025, 2:57 PM0.7.1 of the datetime library, and I'm getting an error. I have read the docs about the Dreprecation of `Instant`, so I'm familiar with updates that need to happen there.
I'm using Clock and have updated to import kotlin.time.Clock. But I get an error (in the IDE and at compile):
> This declaration is only available in Kotlin 2.1 and newer versions and cannot be used with the specified API version 2.0.
Tomáš Procházka
10/31/2025, 1:31 AM