Skip to content

Commit aee5136

Browse files
committed
Remove String.toSomething
Fixes #339
1 parent 8c73b5f commit aee5136

File tree

5 files changed

+12
-38
lines changed

5 files changed

+12
-38
lines changed

core/common/src/DateTimePeriod.kt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,9 @@ public sealed class DateTimePeriod {
298298
}
299299

300300
/**
301-
* Parses the ISO-8601 duration representation as a [DateTimePeriod].
302-
*
303-
* See [DateTimePeriod.parse] for examples.
304-
*
305-
* @throws IllegalArgumentException if the text cannot be parsed or the boundaries of [DateTimePeriod] are exceeded.
306-
*
307-
* @see DateTimePeriod.parse
301+
* @suppress
308302
*/
303+
@Deprecated("Removed to support more idiomatic code. See https://github.com/Kotlin/kotlinx-datetime/issues/339", ReplaceWith("DateTimePeriod.parse(this)"), DeprecationLevel.WARNING)
309304
public fun String.toDateTimePeriod(): DateTimePeriod = DateTimePeriod.parse(this)
310305

311306
/**
@@ -358,16 +353,9 @@ public class DatePeriod internal constructor(
358353
}
359354

360355
/**
361-
* Parses the ISO-8601 duration representation as a [DatePeriod].
362-
*
363-
* This function is equivalent to [DateTimePeriod.parse], but will fail if any of the time components are not
364-
* zero.
365-
*
366-
* @throws IllegalArgumentException if the text cannot be parsed, the boundaries of [DatePeriod] are exceeded,
367-
* or any time components are not zero.
368-
*
369-
* @see DateTimePeriod.parse
356+
* @suppress
370357
*/
358+
@Deprecated("Removed to support more idiomatic code. See https://github.com/Kotlin/kotlinx-datetime/issues/339", ReplaceWith("DatePeriod.parse(this)"), DeprecationLevel.WARNING)
371359
public fun String.toDatePeriod(): DatePeriod = DatePeriod.parse(this)
372360

373361
private class DateTimePeriodImpl(

core/common/src/Instant.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,9 @@ public val Instant.isDistantFuture: Boolean
205205
get() = this >= Instant.DISTANT_FUTURE
206206

207207
/**
208-
* Converts this string representing an instant in ISO-8601 format including date and time components and
209-
* the time zone offset to an [Instant] value.
210-
*
211-
* See [Instant.parse] for examples of instant string representations and discussion of leap seconds.
212-
*
213-
* @throws IllegalArgumentException if the text cannot be parsed or the boundaries of [Instant] are exceeded.
208+
* @suppress
214209
*/
210+
@Deprecated("Removed to support more idiomatic code. See https://github.com/Kotlin/kotlinx-datetime/issues/339", ReplaceWith("Instant.parse(this)"), DeprecationLevel.WARNING)
215211
public fun String.toInstant(): Instant = Instant.parse(this)
216212

217213
/**

core/common/src/LocalDate.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,9 @@ public expect class LocalDate : Comparable<LocalDate> {
114114
}
115115

116116
/**
117-
* Converts this string representing a date in ISO-8601 format to a [LocalDate] value.
118-
*
119-
* See [LocalDate.parse] for examples of local date string representations.
120-
*
121-
* @throws IllegalArgumentException if the text cannot be parsed or the boundaries of [LocalDate] are exceeded.
117+
* @suppress
122118
*/
119+
@Deprecated("Removed to support more idiomatic code. See https://github.com/Kotlin/kotlinx-datetime/issues/339", ReplaceWith("LocalDate.parse(this)"), DeprecationLevel.WARNING)
123120
public fun String.toLocalDate(): LocalDate = LocalDate.parse(this)
124121

125122
/**

core/common/src/LocalDateTime.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,8 @@ public expect class LocalDateTime : Comparable<LocalDateTime> {
133133
}
134134

135135
/**
136-
* Converts this string representing a date/time value in ISO-8601 format including date and time components
137-
* but without any time zone component to a [LocalDateTime] value.
138-
*
139-
* See [LocalDateTime.parse] for examples of date/time string representations.
140-
*
141-
* @throws IllegalArgumentException if the text cannot be parsed or the boundaries of [LocalDateTime] are exceeded.
136+
* @suppress
142137
*/
138+
@Deprecated("Removed to support more idiomatic code. See https://github.com/Kotlin/kotlinx-datetime/issues/339", ReplaceWith("LocalDateTime.parse(this)"), DeprecationLevel.WARNING)
143139
public fun String.toLocalDateTime(): LocalDateTime = LocalDateTime.parse(this)
144140

core/common/src/LocalTime.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,9 @@ public expect class LocalTime : Comparable<LocalTime> {
136136
}
137137

138138
/**
139-
* Converts this string representing a time value in ISO-8601 format to a [LocalTime] value.
140-
*
141-
* See [LocalTime.parse] for examples of time string representations.
142-
*
143-
* @throws IllegalArgumentException if the text cannot be parsed or the boundaries of [LocalTime] are exceeded.
139+
* @suppress
144140
*/
141+
@Deprecated("Removed to support more idiomatic code. See https://github.com/Kotlin/kotlinx-datetime/issues/339", ReplaceWith("LocalTime.parse(this)"), DeprecationLevel.WARNING)
145142
public fun String.toLocalTime(): LocalTime = LocalTime.parse(this)
146143

147144
/**

0 commit comments

Comments
 (0)