Skip to content

Commit 59b18e0

Browse files
committed
Fix typos and small mistakes
1 parent e420bb3 commit 59b18e0

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

core/common/src/DateTimePeriod.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import kotlinx.serialization.Serializable
3939
* [parse] and [toString] methods can be used to obtain a [DateTimePeriod] from and convert it to a string in the
4040
* ISO 8601 extended format (for example, `P1Y2M6DT13H`).
4141
*
42-
* or returned as the result of instant arithmetic operations (see [Instant.periodUntil]).
42+
* `DateTimePeriod` can also be returned as the result of instant arithmetic operations (see [Instant.periodUntil]).
4343
*
4444
* Additionally, there are several `kotlinx-serialization` serializers for [DateTimePeriod]:
4545
* - [DateTimePeriodIso8601Serializer] for the ISO 8601 format;
@@ -54,7 +54,7 @@ public sealed class DateTimePeriod {
5454
* The number of calendar days.
5555
*
5656
* Note that a calendar day is not identical to 24 hours, see [DateTimeUnit.DayBased] for details.
57-
* Also, this field does not overflow into months, so values larger than 30 can be present.
57+
* Also, this field does not overflow into months, so values larger than 31 can be present.
5858
*/
5959
public abstract val days: Int
6060
internal abstract val totalNanoseconds: Long

core/common/src/Instant.kt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ import kotlin.time.*
3838
* The [Clock.System] implementation uses the platform-specific system clock to obtain the current moment.
3939
* Note that this clock is not guaranteed to be monotonic, and it may be adjusted by the user or the system at any time,
4040
* so it should not be used for measuring time intervals.
41-
* For measuring time intervals, consider [TimeSource.Monotonic].
41+
* For that, consider [TimeSource.Monotonic].
4242
*
4343
* ### Obtaining human-readable representations
4444
*
4545
* #### Date and time
4646
*
47-
* [Instant] is essentially the number of seconds and nanoseconds since a deesignated moment in time,
47+
* [Instant] is essentially the number of seconds and nanoseconds since a designated moment in time,
4848
* stored as something like `1709898983.123456789`.
4949
* [Instant] contains no information about what day or time it is, as this depends on the time zone.
50-
* To obtain this information for a specific time zone, obtain a [LocalDateTime] using [Instant.toLocalDateTime]:
50+
* To work with this information for a specific time zone, obtain a [LocalDateTime] using [Instant.toLocalDateTime]:
5151
*
5252
* ```
5353
* val instant = Instant.fromEpochSeconds(1709898983, 123456789)
@@ -57,11 +57,11 @@ import kotlin.time.*
5757
*
5858
* For values very far in the past or the future, this conversion may fail.
5959
* The specific range of values that can be converted to [LocalDateTime] is platform-specific, but at least
60-
* [DISTANT_PAST], [DISTANT_FUTURE], and all values between them can be converted to [LocalDateTime] without exceptions.
60+
* [DISTANT_PAST], [DISTANT_FUTURE], and all values between them can be converted to [LocalDateTime].
6161
*
6262
* #### Date or time separately
6363
*
64-
* To obtain a [LocalDate] or [LocalTime], first, obtain a [LocalDateTime] and then use its [LocalDateTime.date]
64+
* To obtain a [LocalDate] or [LocalTime], first, obtain a [LocalDateTime], and then use its [LocalDateTime.date]
6565
* and [LocalDateTime.time] properties:
6666
*
6767
* ```
@@ -73,7 +73,7 @@ import kotlin.time.*
7373
*
7474
* #### Elapsed-time-based
7575
*
76-
* The [plus] and [minus] operators can be used to add and subtract [Duration]s from an [Instant]:
76+
* The [plus] and [minus] operators can be used to add [Duration]s to and subtract them from an [Instant]:
7777
*
7878
* ```
7979
* Clock.System.now() + Duration.seconds(5) // 5 seconds from now
@@ -85,7 +85,7 @@ import kotlin.time.*
8585
* Clock.System.now().plus(4, DateTimeUnit.HOUR) // 4 hours from now
8686
* ```
8787
*
88-
* Also, there is a [minus] operator that returns a [Duration] representing the difference between two instants:
88+
* Also, there is a [minus] operator that returns the [Duration] representing the difference between two instants:
8989
*
9090
* ```
9191
* val start = Clock.System.now()
@@ -137,7 +137,7 @@ import kotlin.time.*
137137
* [toEpochMilliseconds] can be used to obtain the number of milliseconds since the epoch.
138138
* Note that [Instant] supports nanosecond precision, so converting to milliseconds is a lossy operation.
139139
*
140-
* [parse] and [toString] methods can be used to obtain a [Instant] from and convert it to a string in the
140+
* [parse] and [toString] methods can be used to obtain an [Instant] from and convert it to a string in the
141141
* ISO 8601 extended format (for example, `2023-01-02T22:35:01+01:00`).
142142
* During parsing, the UTC offset is not returned separately.
143143
* If the UTC offset is important, use [DateTimeComponents] with [DateTimeComponents.Formats.ISO_DATE_TIME_OFFSET] to
@@ -210,8 +210,7 @@ public expect class Instant : Comparable<Instant> {
210210
* **Pitfall**: do not use [Duration] values obtained via [Duration.Companion.days], as this is misleading:
211211
* in `kotlinx-datetime`, adding a day is a calendar-based operation, whereas [Duration] always considers
212212
* a day to be 24 hours.
213-
* For an explanation of why this is error-prone, see the section about arithmetic operations in the [LocalDateTime]
214-
* documentation.
213+
* For an explanation of why this is error-prone, see [DateTimeUnit.DayBased].
215214
*/
216215
public operator fun minus(duration: Duration): Instant
217216

core/common/src/LocalDateTime.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import kotlinx.serialization.Serializable
2828
* The arithmetic on [LocalDateTime] values is not provided, since without accounting for the time zone transitions it
2929
* may give misleading results.
3030
*
31-
* For example, in Berlin, naively adding one day to `2021-03-28T02:16:20` without accounting for the time zone would
31+
* For example, in Berlin, naively adding one day to `2021-03-27T02:16:20` without accounting for the time zone would
3232
* result in `2021-03-28T02:16:20`.
3333
* However, this local date-time is invalid, because the clocks moved forward from `02:00` to `03:00` on that day.
3434
* This is known as a "time gap", or a "spring forward" transition.

core/common/src/TimeZone.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import kotlinx.serialization.Serializable
1515
* A time zone, provides the conversion between [Instant] and [LocalDateTime] values
1616
* using a collection of rules specifying which [LocalDateTime] value corresponds to each [Instant].
1717
*
18-
* A time zone needs can be used in [Instant.toLocalDateTime] and [LocalDateTime.toInstant], and also in
18+
* A time zone can be used in [Instant.toLocalDateTime] and [LocalDateTime.toInstant], and also in
1919
* those arithmetic operations on [Instant] that require knowing the calendar.
2020
*
2121
* A [TimeZone] can be constructed using the [TimeZone.of] function, which accepts the string identifier, like

core/common/src/format/DateTimeComponents.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public class DateTimeComponents internal constructor(internal val contents: Date
9090
* ISO 8601 extended format for dates and times with UTC offset.
9191
*
9292
* For specifying the time zone offset, the format uses the [UtcOffset.Formats.ISO] format, except that during
93-
* parsing, specifying the minutes is optional.
93+
* parsing, specifying the minutes of the offset is optional.
9494
*
9595
* This format differs from [LocalTime.Formats.ISO] in its time part in that
9696
* specifying the seconds is *not* optional.

0 commit comments

Comments
 (0)