Skip to content

Improve the KDoc #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b6a6338
Improve the KDoc
dkhalanskyjb Mar 12, 2024
0a7298e
Fix typos and small mistakes
dkhalanskyjb Mar 18, 2024
e076439
Don't hyphenate ISO 8601 when used as a compound adjective
dkhalanskyjb Mar 21, 2024
ca9c739
Implement the first pack of fixes after the review
dkhalanskyjb Mar 21, 2024
c6dd47f
The second pack of changes
dkhalanskyjb Mar 22, 2024
1a4b0f9
Add samples for TimeZone, UtcOffset, and Month
dkhalanskyjb Apr 3, 2024
6883ffb
WIP: add samples for LocalTime
dkhalanskyjb Apr 4, 2024
671ee59
WIP: add samples for some formatting APIs
dkhalanskyjb Apr 5, 2024
bca9eab
More samples
dkhalanskyjb Apr 15, 2024
ba55ab6
Add samples for format builders
dkhalanskyjb Apr 15, 2024
85ab102
Samples for Date(Time)Period and Clock
dkhalanskyjb Apr 16, 2024
cccad01
fixup
dkhalanskyjb Apr 16, 2024
f3d4653
More samples; only LocalDate and Instant left
dkhalanskyjb Apr 16, 2024
77aff41
Samples for LocalDate
dkhalanskyjb Apr 16, 2024
d70657b
Finish adding samples
dkhalanskyjb Apr 17, 2024
3c956e0
Address the reviews
dkhalanskyjb Apr 17, 2024
788285c
Try to find the edge cases that work across platforms
dkhalanskyjb Apr 17, 2024
60ed765
reword
dkhalanskyjb Apr 17, 2024
fd8be7d
Update core/common/src/DateTimeUnit.kt
dkhalanskyjb Apr 19, 2024
1302b7e
Address the comments
dkhalanskyjb Apr 19, 2024
8f73a08
Clarify setting DateTimeComponents.month
dkhalanskyjb Apr 19, 2024
33a3717
Provide a one-line description for every sample
dkhalanskyjb Apr 19, 2024
a2af2de
More additions according to the reviews
dkhalanskyjb Apr 19, 2024
f7878af
feat: new docs review
danil-pavlov Apr 12, 2024
63644e6
Mention the relevant parts of ISO 8601 when describing formats
dkhalanskyjb Apr 30, 2024
e6b758e
Incorporate some more proofreading results
dkhalanskyjb Apr 30, 2024
517ae7a
Address the review
dkhalanskyjb May 1, 2024
f45e493
Address the review
dkhalanskyjb May 3, 2024
8a0e356
~fixup
dkhalanskyjb May 8, 2024
f70e422
Remove separate samples for Long overloads (plus a small fixup)
dkhalanskyjb May 10, 2024
6c1423a
Use yyyy instead of uuuu in the Unicode pattern sample
dkhalanskyjb May 10, 2024
fa59e05
Use Instant.fromEpochSeconds in samples more
dkhalanskyjb May 10, 2024
a529d44
Fix a broken sample reference
dkhalanskyjb May 10, 2024
a0a1335
Fix broken table rendering
dkhalanskyjb May 10, 2024
8851274
Properly display samples in Dokka
dkhalanskyjb May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address the review
  • Loading branch information
dkhalanskyjb committed May 1, 2024
commit 517ae7a9ebc2c230ae2d72ded583603580d2ee03
2 changes: 1 addition & 1 deletion core/common/src/DateTimePeriod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public fun String.toDateTimePeriod(): DateTimePeriod = DateTimePeriod.parse(this
* on [LocalDates][LocalDate], but they also can be passed anywhere a [DateTimePeriod] is expected.
*
* On the JVM, there are `DatePeriod.toJavaPeriod()` and `java.time.Period.toKotlinDatePeriod()`
* extension functions.
* extension functions to convert between `kotlinx.datetime` and `java.time` objects used for the same purpose.
*
* @sample kotlinx.datetime.test.samples.DateTimePeriodSamples.DatePeriodSamples.simpleParsingAndFormatting
*/
Expand Down
6 changes: 4 additions & 2 deletions core/common/src/Instant.kt
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ import kotlin.time.*
*
* ### Platform specifics
*
* On the JVM, there are `Instant.toJavaInstant()` and `java.time.Instant.toKotlinInstant()` extension functions.
* On the Darwin platforms, there are `Instant.toNSDate()` and `NSDate.toKotlinInstant()` extension functions.
* On the JVM, there are `Instant.toJavaInstant()` and `java.time.Instant.toKotlinInstant()`
* extension functions to convert between `kotlinx.datetime` and `java.time` objects used for the same purpose.
* Similarly, on the Darwin platforms, there are `Instant.toNSDate()` and `NSDate.toKotlinInstant()`
* extension functions.
*
* ### Construction, serialization, and deserialization
*
Expand Down
5 changes: 3 additions & 2 deletions core/common/src/LocalDate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ import kotlinx.serialization.Serializable
* [Instant.DISTANT_PAST] and [Instant.DISTANT_FUTURE].
*
* On the JVM,
* there are `LocalDate.toJavaLocalDate()` and `java.time.LocalDate.toKotlinLocalDate()` extension functions.
* On the Darwin platforms, there is a `LocalDate.toNSDateComponents()` extension function.
* there are `LocalDate.toJavaLocalDate()` and `java.time.LocalDate.toKotlinLocalDate()`
* extension functions to convert between `kotlinx.datetime` and `java.time` objects used for the same purpose.
* Similarly, on the Darwin platforms, there is a `LocalDate.toNSDateComponents()` extension function.
*
* ### Construction, serialization, and deserialization
*
Expand Down
4 changes: 2 additions & 2 deletions core/common/src/LocalDateTime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ import kotlinx.serialization.Serializable
* [Instant.DISTANT_PAST] and [Instant.DISTANT_FUTURE].
*
* On the JVM, there are `LocalDateTime.toJavaLocalDateTime()` and `java.time.LocalDateTime.toKotlinLocalDateTime()`
* extension functions.
* On the Darwin platforms, there is a `LocalDateTime.toNSDateComponents()` extension function.
* extension functions to convert between `kotlinx.datetime` and `java.time` objects used for the same purpose.
* Similarly, on the Darwin platforms, there is a `LocalDateTime.toNSDateComponents()` extension function.
*
* ### Construction, serialization, and deserialization
*
Expand Down
12 changes: 8 additions & 4 deletions core/common/src/LocalTime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ import kotlinx.serialization.Serializable
* ### Platform specifics
*
* On the JVM,
* there are `LocalTime.toJavaLocalTime()` and `java.time.LocalTime.toKotlinLocalTime()` extension functions.
* there are `LocalTime.toJavaLocalTime()` and `java.time.LocalTime.toKotlinLocalTime()`
* extension functions to convert between `kotlinx.datetime` and `java.time` objects used for the same purpose.
*
* ### Construction, serialization, and deserialization
*
Expand Down Expand Up @@ -103,7 +104,8 @@ public expect class LocalTime : Comparable<LocalTime> {
* @throws IllegalArgumentException if [secondOfDay] is outside the `0 until 86400` range,
* with 86400 being the number of seconds in a calendar day.
*
* It is incorrect to pass the number of seconds since the start of the day to this function.
* It is incorrect to pass to this function
* the number of seconds that have physically elapsed since the start of the day.
* The reason is that, due to the daylight-saving-time transitions, the number of seconds since the start
* of the day is not a constant value: clocks could be shifted by an hour or more on some dates.
* Use [Instant] to perform reliable time arithmetic.
Expand All @@ -123,7 +125,8 @@ public expect class LocalTime : Comparable<LocalTime> {
* @throws IllegalArgumentException if [millisecondOfDay] is outside the `0 until 86400 * 1_000` range,
* with 86400 being the number of seconds in a calendar day.
*
* It is incorrect to pass the number of milliseconds since the start of the day to this function.
* It is incorrect to pass to this function
* the number of milliseconds that have physically elapsed since the start of the day.
* The reason is that, due to the daylight-saving-time transitions, the number of milliseconds since the start
* of the day is not a constant value: clocks could be shifted by an hour or more on some dates.
* Use [Instant] to perform reliable time arithmetic.
Expand All @@ -142,7 +145,8 @@ public expect class LocalTime : Comparable<LocalTime> {
* @throws IllegalArgumentException if [nanosecondOfDay] is outside the `0 until 86400 * 1_000_000_000` range,
* with 86400 being the number of seconds in a calendar day.
*
* It is incorrect to pass the number of nanoseconds since the start of the day to this function.
* It is incorrect to pass to this function
* the number of nanoseconds that have physically elapsed since the start of the day.
* The reason is that, due to the daylight-saving-time transitions, the number of nanoseconds since the start
* of the day is not a constant value: clocks could be shifted by an hour or more on some dates.
* Use [Instant] to perform reliable time arithmetic.
Expand Down
9 changes: 6 additions & 3 deletions core/common/src/TimeZone.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import kotlinx.serialization.Serializable
* For interaction with `kotlinx-serialization`, [TimeZoneSerializer] is provided that serializes the time zone as its
* identifier.
*
* On the JVM, there are `TimeZone.toJavaZoneId()` and `java.time.ZoneId.toKotlinTimeZone()` extension functions.
* On the Darwin platforms, there are `TimeZone.toNSTimeZone()` and `NSTimeZone.toKotlinTimeZone()` extension functions.
* On the JVM, there are `TimeZone.toJavaZoneId()` and `java.time.ZoneId.toKotlinTimeZone()`
* extension functions to convert between `kotlinx.datetime` and `java.time` objects used for the same purpose.
* Similarly, on the Darwin platforms, there are `TimeZone.toNSTimeZone()` and `NSTimeZone.toKotlinTimeZone()` extension
* functions.
*
* @sample kotlinx.datetime.test.samples.TimeZoneSamples.usage
*/
Expand Down Expand Up @@ -142,7 +144,8 @@ public expect open class TimeZone {
* changes in legislation or other reasons.
*
* On the JVM, there are `FixedOffsetTimeZone.toJavaZoneOffset()` and
* `java.time.ZoneOffset.toKotlinFixedOffsetTimeZone()` extension functions.
* `java.time.ZoneOffset.toKotlinFixedOffsetTimeZone()`
* extension functions to convert between `kotlinx.datetime` and `java.time` objects used for the same purpose.
* Note also the functions available for [TimeZone] in general.
*
* @sample kotlinx.datetime.test.samples.TimeZoneSamples.FixedOffsetTimeZoneSamples.casting
Expand Down
8 changes: 5 additions & 3 deletions core/common/src/UtcOffset.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import kotlinx.serialization.Serializable
* ### Platform specifics
*
* On the JVM, there are `UtcOffset.toJavaZoneOffset()` and `java.time.ZoneOffset.toKotlinUtcOffset()`
* extension functions.
* extension functions to convert between `kotlinx.datetime` and `java.time` objects used for the same purpose.
*
* ### Construction, serialization, and deserialization
*
Expand Down Expand Up @@ -218,8 +218,10 @@ public fun UtcOffset(): UtcOffset = UtcOffset.ZERO
/**
* Returns the fixed-offset time zone with the given UTC offset.
*
* **Pitfall**: if the offset is not fixed, the returned time zone will not reflect the changes in the offset.
* Use [TimeZone.of] with a IANA timezone name to obtain a time zone that can handle changes in the offset.
* **Pitfall**: UTC offsets are static values and do not change with time.
* If the logic requires that the offset changes with time, for example, to account for daylight-saving-time
* transitions, use [TimeZone.of] with a IANA time zone name to obtain a time zone that can handle
* changes in the offset.
*
* @sample kotlinx.datetime.test.samples.UtcOffsetSamples.asFixedOffsetTimeZone
*/
Expand Down
1 change: 0 additions & 1 deletion core/common/src/format/LocalDateFormat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ private fun MonthNames.toKotlinCode(): String = when (this.names) {
*
* @sample kotlinx.datetime.test.samples.format.LocalDateFormatSamples.DayOfWeekNamesSamples.usage
* @sample kotlinx.datetime.test.samples.format.LocalDateFormatSamples.DayOfWeekNamesSamples.constructionFromList
>>>>>>> 585441e (WIP: add samples for some formatting APIs)
*/
public class DayOfWeekNames(
/**
Expand Down