From d9748f1680858027889096d71d01a958738c0389 Mon Sep 17 00:00:00 2001 From: Holger Brandl Date: Fri, 20 Jan 2023 12:45:39 +0100 Subject: [PATCH 1/2] Improved LocalDateTime documentation Improved reasoning for missing date-time arithmetics and added an example --- core/common/src/LocalDateTime.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/common/src/LocalDateTime.kt b/core/common/src/LocalDateTime.kt index 2588fa6c0..26d3d345a 100644 --- a/core/common/src/LocalDateTime.kt +++ b/core/common/src/LocalDateTime.kt @@ -20,7 +20,10 @@ import kotlinx.serialization.Serializable * The main purpose of this class is to provide human-readable representations of [Instant] values, or to transfer them * as data. * - * The arithmetic on [LocalDateTime] values is not provided, since without accounting for the time zone transitions it may give misleading results. + * The arithmetic on [LocalDateTime] values is not provided, since without accounting for the time zone transitions it + * may give misleading results. For example, assuming March 26, 2023, 22:00 as a value of `LocalDateTime`, adding 10 hours + * is ambigous because that is when daylight savings kick in in some timzones: For the US, if you just add 10 hours to + * the clock at this particular day, it would be 8:00, but if you just waited 10 hours it would be 9:00. */ @Serializable(with = LocalDateTimeIso8601Serializer::class) public expect class LocalDateTime : Comparable { From 6fff1016154d4042e04b218125ab0c51452c5288 Mon Sep 17 00:00:00 2001 From: Holger Brandl Date: Fri, 20 Jan 2023 21:34:08 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: ilya-g --- core/common/src/LocalDateTime.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/common/src/LocalDateTime.kt b/core/common/src/LocalDateTime.kt index 26d3d345a..f6910d062 100644 --- a/core/common/src/LocalDateTime.kt +++ b/core/common/src/LocalDateTime.kt @@ -22,8 +22,8 @@ import kotlinx.serialization.Serializable * * The arithmetic on [LocalDateTime] values is not provided, since without accounting for the time zone transitions it * may give misleading results. For example, assuming March 26, 2023, 22:00 as a value of `LocalDateTime`, adding 10 hours - * is ambigous because that is when daylight savings kick in in some timzones: For the US, if you just add 10 hours to - * the clock at this particular day, it would be 8:00, but if you just waited 10 hours it would be 9:00. + * is ambiguous because that is when daylight savings kick in in some time zones: for the US, if you just add 10 hours to + * the clock at this particular day, it would be 8:00, but if you just waited 10 hours, it would be 9:00. */ @Serializable(with = LocalDateTimeIso8601Serializer::class) public expect class LocalDateTime : Comparable {