Skip to content

Commit f74fdab

Browse files
authored
update: second text review (#400)
1 parent bc8adee commit f74fdab

17 files changed

+116
-116
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The library provides a basic set of types for working with date and time:
4747
- `DatePeriod` is a subclass of `DateTimePeriod` with zero time components,
4848
it represents a difference between two LocalDate values decomposed into date units.
4949
- `DateTimeUnit` provides a set of predefined date and time units to use in arithmetic operations on `Instant` and `LocalDate`.
50-
- `UtcOffset` represents the amount of time the local date/time at a particular time zone differs from the date/time at UTC.
50+
- `UtcOffset` represents the amount of time the local datetime at a particular time zone differs from the datetime at UTC.
5151

5252
### Type use-cases
5353

@@ -63,7 +63,7 @@ Here is some basic advice on how to choose which of the date-carrying types to u
6363
rules might change unexpectedly in the future. In this [blog post](https://codeblog.jonskeet.uk/2019/03/27/storing-utc-is-not-a-silver-bullet/), you can read more about why it's not always
6464
a good idea to use `Instant` everywhere.
6565

66-
Also, use `LocalDateTime` to decode an `Instant` to its local date-time components for display and UIs.
66+
Also, use `LocalDateTime` to decode an `Instant` to its local datetime components for display and UIs.
6767

6868
- Use `LocalDate` to represent the date of an event that does not have a specific time associated with it (like a birth date).
6969

@@ -99,7 +99,7 @@ An `Instant` is just a counter of high resolution time intervals since the begin
9999
To get human readable components from an `Instant` value, you need to convert it to the `LocalDateTime`
100100
type that represents date and time components without a reference to the particular time zone.
101101

102-
The `TimeZone` type provides the rules to convert instants from and to date/time components.
102+
The `TimeZone` type provides the rules to convert instants from and to datetime components.
103103

104104
```kotlin
105105
val currentMoment: Instant = Clock.System.now()
@@ -172,7 +172,7 @@ val hourMinute = LocalTime(hour = 12, minute = 13)
172172
An `Instant` can be converted to a number of milliseconds since the Unix/POSIX epoch with the `toEpochMilliseconds()` function.
173173
To convert back, use the companion object function `Instant.fromEpochMilliseconds(Long)`.
174174

175-
### Converting instant and local date/time to and from the ISO 8601 string
175+
### Converting instant and local datetime to and from the ISO 8601 string
176176

177177
`Instant`, `LocalDateTime`, `LocalDate` and `LocalTime` provide shortcuts for
178178
parsing and formatting them using the extended ISO 8601 format.
@@ -268,7 +268,7 @@ dateTimeFormat.parse("2023-12-24T23:59:59")
268268

269269
Sometimes, the required string format doesn't fully correspond to any of the
270270
classes `kotlinx-datetime` provides. In these cases, `DateTimeComponents`, a
271-
collection of all date-time fields, can be used instead.
271+
collection of all datetime fields, can be used instead.
272272

273273
```kotlin
274274
// import kotlinx.datetime.format.*
@@ -341,7 +341,7 @@ val diffInMonths = instantInThePast.until(Clock.System.now(), DateTimeUnit.MONTH
341341
```
342342
There are also shortcuts `yearsUntil(...)`, `monthsUntil(...)`, and `daysUntil(...)`.
343343

344-
A particular amount of date/time units or a date/time period can be added to an `Instant` with the `plus` function:
344+
A particular amount of datetime units or a datetime period can be added to an `Instant` with the `plus` function:
345345

346346
```kotlin
347347
val now = Clock.System.now()
@@ -395,7 +395,7 @@ val localDateTimeTwoDaysLater = instantTwoDaysLater.toLocalDateTime(timeZone)
395395

396396
## Implementation
397397

398-
The implementation of date/time types, such as `Instant`, `LocalDateTime`, `TimeZone` and so on, relies on:
398+
The implementation of datetime types, such as `Instant`, `LocalDateTime`, `TimeZone` and so on, relies on:
399399

400400
- in JVM: [`java.time`](https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html) API;
401401
- in Js and Wasm-Js: [`js-joda`](https://js-joda.github.io/js-joda/) library;
@@ -405,7 +405,7 @@ The implementation of date/time types, such as `Instant`, `LocalDateTime`, `Time
405405
## Known/open issues, work TBD
406406

407407
- [x] Some kind of `Clock` interface is needed as a pluggable replacement for `Instant.now()`.
408-
- [ ] Flexible locale-neutral parsing and formatting facilities are needed to support various date/time interchange
408+
- [ ] Flexible locale-neutral parsing and formatting facilities are needed to support various datetime interchange
409409
formats that are used in practice (in particular, various RFCs).
410410

411411
## Using in your projects

core/common/src/Clock.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public interface Clock {
2121
/**
2222
* Returns the [Instant] corresponding to the current time, according to this clock.
2323
*
24-
* It is not guaranteed that calling [now] later will return a larger [Instant].
25-
* In particular, for [Clock.System] it is completely expected that the opposite will happen,
24+
* Calling [now] later is not guaranteed to return a larger [Instant].
25+
* In particular, for [Clock.System], the opposite is completely expected,
2626
* and it must be taken into account.
2727
* See the [System] documentation for details.
2828
*

core/common/src/DateTimePeriod.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ public class DatePeriod internal constructor(
434434
/**
435435
* Constructs a new [DatePeriod].
436436
*
437-
* It is always recommended to name the arguments explicitly when constructing this manually,
437+
* It is recommended to always name the arguments explicitly when constructing this manually,
438438
* like `DatePeriod(years = 1, months = 12, days = 16)`.
439439
*
440440
* The passed numbers are not stored as is but are normalized instead for human readability, so, for example,
@@ -527,7 +527,7 @@ internal fun buildDateTimePeriod(totalMonths: Int = 0, days: Int = 0, totalNanos
527527
/**
528528
* Constructs a new [DateTimePeriod]. If all the time components are zero, returns a [DatePeriod].
529529
*
530-
* It is recommended to always explicitly name the arguments when constructing this manually,
530+
* It is recommended to always name the arguments explicitly when constructing this manually,
531531
* like `DateTimePeriod(years = 1, months = 12, days = 16)`.
532532
*
533533
* The passed numbers are not stored as is but are normalized instead for human readability, so, for example,

core/common/src/DateTimeUnit.kt

+15-15
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import kotlin.time.Duration.Companion.nanoseconds
1414
/**
1515
* A unit for measuring time; for example, a second, 20 seconds, a day, a month, or a quarter.
1616
*
17-
* This class is used to express arithmetic operations like addition and subtraction on date-time values:
18-
* for example, adding 10 days to a date-time value, subtracting 5 hours from a date-time value, or finding the
19-
* number of 30-second intervals between two date-time values.
17+
* This class is used to express arithmetic operations like addition and subtraction on datetime values:
18+
* for example, adding 10 days to a datetime value, subtracting 5 hours from a datetime value, or finding the
19+
* number of 30-second intervals between two datetime values.
2020
*
2121
* ### Interaction with other entities
2222
*
@@ -39,7 +39,7 @@ import kotlin.time.Duration.Companion.nanoseconds
3939
* "two days and three hours".
4040
* [DatePeriod] is specifically a combination of [DateTimeUnit.DateBased] values.
4141
* [DateTimePeriod] is more flexible than [DateTimeUnit] because it can express a combination of values with different
42-
* kinds of units, but in exchange, the duration of time between two [Instant] or [LocalDate] values can be
42+
* kinds of units. However, in exchange, the duration of time between two [Instant] or [LocalDate] values can be
4343
* measured in terms of some [DateTimeUnit], but not [DateTimePeriod] or [DatePeriod].
4444
*
4545
* ### Construction, serialization, and deserialization
@@ -63,20 +63,20 @@ import kotlin.time.Duration.Companion.nanoseconds
6363
public sealed class DateTimeUnit {
6464

6565
/**
66-
* Produces a date-time unit that is a multiple of this unit times the specified integer [scalar] value.
66+
* Produces a datetime unit that is a multiple of this unit times the specified integer [scalar] value.
6767
*
6868
* @throws ArithmeticException if the result overflows.
6969
* @sample kotlinx.datetime.test.samples.DateTimeUnitSamples.multiplication
7070
*/
7171
public abstract operator fun times(scalar: Int): DateTimeUnit
7272

7373
/**
74-
* A [date-time unit][DateTimeUnit] that has the precise time duration.
74+
* A [datetime unit][DateTimeUnit] that has the precise time duration.
7575
*
7676
* Such units are independent of the time zone.
7777
* Any such unit can be represented as some fixed number of nanoseconds.
7878
*
79-
* @see DateTimeUnit for a description of date-time units in general.
79+
* @see DateTimeUnit for a description of datetime units in general.
8080
* @sample kotlinx.datetime.test.samples.DateTimeUnitSamples.timeBasedUnit
8181
*/
8282
@Serializable(with = TimeBasedDateTimeUnitSerializer::class)
@@ -141,13 +141,13 @@ public sealed class DateTimeUnit {
141141
}
142142

143143
/**
144-
* A [date-time unit][DateTimeUnit] equal to some number of days or months.
144+
* A [datetime unit][DateTimeUnit] equal to some number of days or months.
145145
*
146146
* Operations involving `DateBased` units are performed on dates. The same operations on [Instants][Instant]
147147
* require a [TimeZone] to find the corresponding [LocalDateTimes][LocalDateTime] first to perform
148148
* the operation with the date component of these `LocalDateTime` values.
149149
*
150-
* @see DateTimeUnit for a description of date-time units in general.
150+
* @see DateTimeUnit for a description of datetime units in general.
151151
* @see DateTimeUnit.DayBased for specifically day-based units.
152152
* @see DateTimeUnit.MonthBased for specifically month-based units.
153153
*/
@@ -162,17 +162,17 @@ public sealed class DateTimeUnit {
162162
}
163163

164164
/**
165-
* A [date-time unit][DateTimeUnit] equal to some number of calendar days.
165+
* A [datetime unit][DateTimeUnit] equal to some number of calendar days.
166166
*
167167
* A calendar day is not considered identical to 24 hours.
168168
* Thus, a `DayBased` unit cannot be expressed as a multiple of some [TimeBased] unit.
169169
*
170170
* The reason lies in time zone transitions, because of which some days can be 23 or 25 hours.
171171
* For example, we say that exactly a whole day has passed between `2019-10-27T02:59` and `2019-10-28T02:59`
172-
* in Berlin, despite the fact that the clocks were turned back one hour, so there are, in fact, 25 hours
173-
* between the two date-times.
172+
* in Berlin, even though the clocks were turned back one hour, so there are, in fact, 25 hours
173+
* between the two datetimes.
174174
*
175-
* @see DateTimeUnit for a description of date-time units in general.
175+
* @see DateTimeUnit for a description of datetime units in general.
176176
* @sample kotlinx.datetime.test.samples.DateTimeUnitSamples.dayBasedUnit
177177
*/
178178
@Serializable(with = DayBasedDateTimeUnitSerializer::class)
@@ -202,12 +202,12 @@ public sealed class DateTimeUnit {
202202
}
203203

204204
/**
205-
* A [date-time unit][DateTimeUnit] equal to some number of months.
205+
* A [datetime unit][DateTimeUnit] equal to some number of months.
206206
*
207207
* Since different months have a different number of days, a `MonthBased` unit cannot be expressed
208208
* as a multiple of some [DayBased]-unit.
209209
*
210-
* @see DateTimeUnit for a description of date-time units in general.
210+
* @see DateTimeUnit for a description of datetime units in general.
211211
* @sample kotlinx.datetime.test.samples.DateTimeUnitSamples.monthBasedUnit
212212
*/
213213
@Serializable(with = MonthBasedDateTimeUnitSerializer::class)

core/common/src/DayOfWeek.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public expect enum class DayOfWeek {
3131
public val DayOfWeek.isoDayNumber: Int get() = ordinal + 1
3232

3333
/**
34-
* Returns the [DayOfWeek] instance for the given ISO 8601 week day number. Monday is 1, Sunday is 7.
34+
* Returns the [DayOfWeek] instance for the given ISO 8601 weekday number. Monday is 1, and Sunday is 7.
3535
*
3636
* @throws IllegalArgumentException if the day number is not in the range 1..7
3737
* @sample kotlinx.datetime.test.samples.DayOfWeekSamples.constructorFunction

core/common/src/Exceptions.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package kotlinx.datetime
77

88
/**
9-
* Thrown by date-time arithmetic operations if the result cannot be computed or represented.
9+
* Thrown by datetime arithmetic operations if the result cannot be computed or represented.
1010
*/
1111
public class DateTimeArithmeticException: RuntimeException {
1212
public constructor(): super()

core/common/src/Instant.kt

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import kotlin.time.*
1515
/**
1616
* A moment in time.
1717
*
18-
* A point in time must be uniquely identified so that it is independent of a time zone.
18+
* A point in time must be uniquely identified in a way that is independent of a time zone.
1919
* For example, `1970-01-01, 00:00:00` does not represent a moment in time since this would happen at different times
2020
* in different time zones: someone in Tokyo would think it is already `1970-01-01` several hours earlier than someone in
2121
* Berlin would. To represent such entities, use [LocalDateTime].
@@ -36,7 +36,7 @@ import kotlin.time.*
3636
* ```
3737
*
3838
* The [Clock.System] implementation uses the platform-specific system clock to obtain the current moment.
39-
* Note that this clock is not guaranteed to be monotonic, and it may be adjusted by the user or the system at any time,
39+
* Note that this clock is not guaranteed to be monotonic, and the user or the system may adjust it at any time,
4040
* so it should not be used for measuring time intervals.
4141
* For that, consider using [TimeSource.Monotonic] and [TimeMark] instead of [Clock.System] and [Instant].
4242
*
@@ -79,7 +79,7 @@ import kotlin.time.*
7979
* Clock.System.now() + 5.seconds // 5 seconds from now
8080
* ```
8181
*
82-
* Durations can also be represented as multiples of some [time-based date-time unit][DateTimeUnit.TimeBased]:
82+
* Durations can also be represented as multiples of some [time-based datetime unit][DateTimeUnit.TimeBased]:
8383
*
8484
* ```
8585
* Clock.System.now().plus(4, DateTimeUnit.HOUR) // 4 hours from now
@@ -121,7 +121,7 @@ import kotlin.time.*
121121
* // Two months, three days, four hours, and five minutes until the concert
122122
* ```
123123
*
124-
* or [Instant.until] method, as well as [Instant.daysUntil], [Instant.monthsUntil],
124+
* Or the [Instant.until] method, as well as [Instant.daysUntil], [Instant.monthsUntil],
125125
* and [Instant.yearsUntil] extension functions:
126126
*
127127
* ```
@@ -223,7 +223,7 @@ public expect class Instant : Comparable<Instant> {
223223
/**
224224
* Returns the number of milliseconds from the epoch instant `1970-01-01T00:00:00Z`.
225225
*
226-
* Any fractional part of millisecond is rounded toward zero to the whole number of milliseconds.
226+
* Any fractional part of a millisecond is rounded toward zero to the whole number of milliseconds.
227227
*
228228
* If the result does not fit in [Long], returns [Long.MAX_VALUE] for a positive result or [Long.MIN_VALUE] for a negative result.
229229
*
@@ -362,13 +362,13 @@ public expect class Instant : Comparable<Instant> {
362362
/**
363363
* A shortcut for calling [DateTimeFormat.parse], followed by [DateTimeComponents.toInstantUsingOffset].
364364
*
365-
* Parses a string that represents an instant including date and time components and a mandatory
365+
* Parses a string that represents an instant, including date and time components and a mandatory
366366
* time zone offset and returns the parsed [Instant] value.
367367
*
368368
* The string is considered to represent time on the UTC-SLS time scale instead of UTC.
369369
* In practice, this means that, even if there is a leap second on the given day, it will not affect how the
370370
* time is parsed, even if it's in the last 1000 seconds of the day.
371-
* Instead, even if there is a negative leap second on the given day, 23:59:59 is still considered valid time.
371+
* Instead, even if there is a negative leap second on the given day, 23:59:59 is still considered a valid time.
372372
* 23:59:60 is invalid on UTC-SLS, so parsing it will fail.
373373
*
374374
* If the format is not specified, [DateTimeComponents.Formats.ISO_DATE_TIME_OFFSET] is used.

0 commit comments

Comments
 (0)