Skip to content

Commit f07c80e

Browse files
committed
Remove String.toSomething
Fixes #339
1 parent b5236ed commit f07c80e

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
@@ -207,13 +207,9 @@ public val Instant.isDistantFuture: Boolean
207207
get() = this >= Instant.DISTANT_FUTURE
208208

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

219215
/**

core/common/src/LocalDate.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,9 @@ public fun LocalDate.Companion.parse(input: CharSequence, format: DateTimeFormat
192192
format.parse(input)
193193

194194
/**
195-
* Converts this string representing a date in ISO-8601 format to a [LocalDate] value.
196-
*
197-
* See [LocalDate.parse] for examples of local date string representations.
198-
*
199-
* @throws IllegalArgumentException if the text cannot be parsed or the boundaries of [LocalDate] are exceeded.
195+
* @suppress
200196
*/
197+
@Deprecated("Removed to support more idiomatic code. See https://github.com/Kotlin/kotlinx-datetime/issues/339", ReplaceWith("LocalDate.parse(this)"), DeprecationLevel.WARNING)
201198
public fun String.toLocalDate(): LocalDate = LocalDate.parse(this)
202199

203200
/**

core/common/src/LocalDateTime.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,8 @@ public fun LocalDateTime.Companion.parse(input: CharSequence, format: DateTimeFo
235235
format.parse(input)
236236

237237
/**
238-
* Converts this string representing a date/time value in ISO-8601 format including date and time components
239-
* but without any time zone component to a [LocalDateTime] value.
240-
*
241-
* See [LocalDateTime.parse] for examples of date/time string representations.
242-
*
243-
* @throws IllegalArgumentException if the text cannot be parsed or the boundaries of [LocalDateTime] are exceeded.
238+
* @suppress
244239
*/
240+
@Deprecated("Removed to support more idiomatic code. See https://github.com/Kotlin/kotlinx-datetime/issues/339", ReplaceWith("LocalDateTime.parse(this)"), DeprecationLevel.WARNING)
245241
public fun String.toLocalDateTime(): LocalDateTime = LocalDateTime.parse(this)
246242

core/common/src/LocalTime.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,9 @@ public fun LocalTime.Companion.parse(input: CharSequence, format: DateTimeFormat
203203
format.parse(input)
204204

205205
/**
206-
* Converts this string representing a time value in ISO-8601 format to a [LocalTime] value.
207-
*
208-
* See [LocalTime.parse] for examples of time string representations.
209-
*
210-
* @throws IllegalArgumentException if the text cannot be parsed or the boundaries of [LocalTime] are exceeded.
206+
* @suppress
211207
*/
208+
@Deprecated("Removed to support more idiomatic code. See https://github.com/Kotlin/kotlinx-datetime/issues/339", ReplaceWith("LocalTime.parse(this)"), DeprecationLevel.WARNING)
212209
public fun String.toLocalTime(): LocalTime = LocalTime.parse(this)
213210

214211
/**

0 commit comments

Comments
 (0)