Skip to content

Commit 94bcc6f

Browse files
authored
Fix some articles in README.md (#292)
1 parent acf2a8f commit 94bcc6f

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ all-encompassing and lacks some domain-specific utilities that special-purpose a
2121
We chose convenience over generality, so the API surface this library provides is as minimal as possible
2222
to meet the use-cases.
2323

24-
The library puts a clear boundary between physical time of an instant and a local, time-zone dependent civil time,
25-
consisting of components such as year, month, etc that people use when talking about time.
24+
The library puts a clear boundary between the physical time of an instant and the local, time-zone dependent
25+
civil time, consisting of components such as year, month, etc that people use when talking about time.
2626
We intentionally avoid entities in the library that mix both together and could be misused.
2727
However, there are convenience operations that take, for example, a physical instant and perform a calendar-based
28-
adjustment (such as adding a month); all such operation
28+
adjustment (such as adding a month); all such operations
2929
explicitly take a time-zone information as parameter to clearly state that their result depends on the civil time-zone
3030
rules which are subject to change at any time.
3131

@@ -34,7 +34,7 @@ its scope. Internationalization (such as locale-specific month and day names) is
3434

3535
## Types
3636

37-
The library provides the basic set of types for working with date and time:
37+
The library provides a basic set of types for working with date and time:
3838

3939
- `Instant` to represent a moment on the UTC-SLS time scale;
4040
- `Clock` to obtain the current instant;
@@ -65,9 +65,9 @@ Here is some basic advice on how to choose which of the date-carrying types to u
6565

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

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

70-
- Use `LocalTime` to represent a time of the event that does not have a specific date associated with it.
70+
- Use `LocalTime` to represent the time of an event that does not have a specific date associated with it.
7171

7272
## Operations
7373

@@ -95,9 +95,9 @@ val currentMoment = Clock.System.now()
9595

9696
### Converting an instant to local date and time components
9797

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

102102
The `TimeZone` type provides the rules to convert instants from and to date/time components.
103103

@@ -107,7 +107,7 @@ val datetimeInUtc: LocalDateTime = currentMoment.toLocalDateTime(TimeZone.UTC)
107107
val datetimeInSystemZone: LocalDateTime = currentMoment.toLocalDateTime(TimeZone.currentSystemDefault())
108108
```
109109

110-
`LocalDateTime` instance exposes familiar components of the Gregorian calendar:
110+
A `LocalDateTime` instance exposes familiar components of the Gregorian calendar:
111111
`year`, `month`, `dayOfMonth`, `hour`, and so on up to `nanosecond`.
112112
The property `dayOfWeek` shows what weekday that date is,
113113
and `dayOfYear` shows the day number since the beginning of a year.
@@ -119,7 +119,7 @@ val tzBerlin = TimeZone.of("Europe/Berlin")
119119
val datetimeInBerlin = currentMoment.toLocalDateTime(tzBerlin)
120120
```
121121

122-
`LocalDateTime` instance can be constructed from individual components:
122+
A `LocalDateTime` instance can be constructed from individual components:
123123

124124
```kotlin
125125
val kotlinReleaseDateTime = LocalDateTime(2016, 2, 15, 16, 57, 0, 0)
@@ -134,7 +134,7 @@ val kotlinReleaseInstant = kotlinReleaseDateTime.toInstant(TimeZone.of("UTC+3"))
134134

135135
### Getting local date components
136136

137-
`LocalDate` type represents local date without time. You can obtain it from `Instant`
137+
A `LocalDate` represents a local date without time. You can obtain one from an `Instant`
138138
by converting it to `LocalDateTime` and taking its `date` property.
139139

140140
```kotlin
@@ -152,15 +152,15 @@ val knownDate = LocalDate(2020, 2, 21)
152152

153153
### Getting local time components
154154

155-
`LocalTime` type represents local time without date. You can obtain it from `Instant`
155+
A `LocalTime` represents local time without date. You can obtain one from an `Instant`
156156
by converting it to `LocalDateTime` and taking its `time` property.
157157

158158
```kotlin
159159
val now: Instant = Clock.System.now()
160160
val thisTime: LocalTime = now.toLocalDateTime(TimeZone.currentSystemDefault()).time
161161
```
162162

163-
`LocalTime` can be constructed from four components, hour, minute, second and nanosecond:
163+
A `LocalTime` can be constructed from four components, hour, minute, second and nanosecond:
164164
```kotlin
165165
val knownTime = LocalTime(hour = 23, minute = 59, second = 12)
166166
val timeWithNanos = LocalTime(hour = 23, minute = 59, second = 12, nanosecond = 999)
@@ -170,7 +170,7 @@ val hourMinute = LocalTime(hour = 12, minute = 13)
170170
### Converting instant to and from unix time
171171

172172
An `Instant` can be converted to a number of milliseconds since the Unix/POSIX epoch with the `toEpochMilliseconds()` function.
173-
To convert back, use `Instant.fromEpochMilliseconds(Long)` companion object function.
173+
To convert back, use the companion object function `Instant.fromEpochMilliseconds(Long)`.
174174

175175
### Converting instant and local date/time to and from string
176176

@@ -185,14 +185,14 @@ instantNow.toString() // returns something like 2015-12-31T12:30:00Z
185185
val instantBefore = Instant.parse("2010-06-01T22:19:44.475Z")
186186
```
187187

188-
Alternatively, `String.to...()` extension functions can be used instead of `parse`,
188+
Alternatively, the `String.to...()` extension functions can be used instead of `parse`,
189189
where it feels more convenient:
190190

191-
`LocalDateTime` uses the similar format, but without `Z` UTC time zone designator in the end.
191+
`LocalDateTime` uses a similar format, but without `Z` UTC time zone designator in the end.
192192

193-
`LocalDate` uses format with just year, month, and date components, e.g. `2010-06-01`.
193+
`LocalDate` uses a format with just year, month, and date components, e.g. `2010-06-01`.
194194

195-
`LocalTime` uses format with just hour, minute, second and (if non-zero) nanosecond components, e.g. `12:01:03`.
195+
`LocalTime` uses a format with just hour, minute, second and (if non-zero) nanosecond components, e.g. `12:01:03`.
196196

197197
```kotlin
198198
"2010-06-01T22:19:44.475Z".toInstant()
@@ -214,13 +214,13 @@ val equidistantInstantInTheFuture: Instant = now + durationSinceThen
214214
`Duration` is a type from the experimental `kotlin.time` package in the Kotlin standard library.
215215
This type holds the amount of time that can be represented in different time units: from nanoseconds to 24H days.
216216

217-
To get the calendar difference between two instants you can use `Instant.periodUntil(Instant, TimeZone)` function.
217+
To get the calendar difference between two instants you can use the `Instant.periodUntil(Instant, TimeZone)` function.
218218

219219
```kotlin
220220
val period: DateTimePeriod = instantInThePast.periodUntil(Clock.System.now(), TimeZone.UTC)
221221
```
222222

223-
`DateTimePeriod` represents a difference between two particular moments as a sum of calendar components,
223+
A `DateTimePeriod` represents a difference between two particular moments as a sum of calendar components,
224224
like "2 years, 3 months, 10 days, and 22 hours".
225225

226226
The difference can be calculated as an integer amount of specified date or time units:
@@ -239,19 +239,19 @@ val tomorrow = now.plus(2, DateTimeUnit.DAY, systemTZ)
239239
val threeYearsAndAMonthLater = now.plus(DateTimePeriod(years = 3, months = 1), systemTZ)
240240
```
241241

242-
Note that `plus` and `...until` operations require `TimeZone` as a parameter because the calendar interval between
242+
Note that `plus` and `...until` operations require a `TimeZone` as a parameter because the calendar interval between
243243
two particular instants can be different, when calculated in different time zones.
244244

245245
### Date arithmetic
246246

247-
The similar operations with date units are provided for `LocalDate` type:
247+
Similar operations with date units are provided for `LocalDate` type:
248248

249249
- `LocalDate.plus(number, DateTimeUnit.DateBased)`
250250
- `LocalDate.plus(DatePeriod)`
251251
- `LocalDate.until(LocalDate, DateTimeUnit.DateBased)` and the shortcuts `yearsUntil`, `monthUntil`, `daysUntil`
252252
- `LocalDate.periodUntil(LocalDate): DatePeriod` and `LocalDate.minus(LocalDate): DatePeriod`
253253

254-
Notice that instead of general `DateTimeUnit` and `DateTimePeriod` we're using their subtypes
254+
Notice that, instead of the general `DateTimeUnit` and `DateTimePeriod` types, we're using their subtypes
255255
`DateTimeUnit.DateBased` and `DatePeriod` respectively. This allows preventing the situations when
256256
time components are being added to a date at compile time.
257257

@@ -288,7 +288,7 @@ The implementation of date/time types, such as `Instant`, `LocalDateTime`, `Time
288288

289289
- in JVM: [`java.time`](https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html) API;
290290
- in JS: [`js-joda`](https://js-joda.github.io/js-joda/) library;
291-
- in Native: based on [ThreeTen backport project](https://www.threeten.org/threetenbp/)
291+
- in Native: based on the [ThreeTen backport project](https://www.threeten.org/threetenbp/)
292292
- time zone support is provided by [date](https://github.com/HowardHinnant/date/) C++ library;
293293

294294
## Known/open issues, work TBD

0 commit comments

Comments
 (0)