@@ -5,6 +5,7 @@ import kotlinx.datetime.LocalDateTime
55import kotlinx.datetime.LocalTime
66import kotlinx.datetime.TimeZone
77import kotlinx.datetime.toLocalDateTime
8+ import kotlinx.datetime.toStdlibInstant
89import org.jetbrains.kotlinx.dataframe.AnyBaseCol
910import org.jetbrains.kotlinx.dataframe.AnyCol
1011import org.jetbrains.kotlinx.dataframe.AnyFrame
@@ -1281,6 +1282,24 @@ public fun DataColumn<String>.convertToStdlibInstant(): DataColumn<StdlibInstant
12811282public fun DataColumn<String?>.convertToStdlibInstant (): DataColumn <StdlibInstant ?> =
12821283 map { it?.let { StdlibInstant .parse(it) } }
12831284
1285+ /* *
1286+ * Converts values in this [kotlinx.datetime.Instant] column to [kotlin.time.Instant].
1287+ *
1288+ * @return A new [DataColumn] with the [kotlin.time.Instant] values.
1289+ */
1290+ @JvmName(" convertToStdlibInstantFromDeprecatedInstant" )
1291+ public fun DataColumn<DeprecatedInstant>.convertToStdlibInstant (): DataColumn <StdlibInstant > =
1292+ map { it.toStdlibInstant() }
1293+
1294+ /* *
1295+ * Converts values in this [kotlinx.datetime.Instant] column to [kotlin.time.Instant]. Preserves null values.
1296+ *
1297+ * @return A new [DataColumn] with the [kotlin.time.Instant] nullable values.
1298+ */
1299+ @JvmName(" convertToStdlibInstantFromDeprecatedInstantNullable" )
1300+ public fun DataColumn<DeprecatedInstant?>.convertToStdlibInstant (): DataColumn <StdlibInstant ?> =
1301+ map { it?.toStdlibInstant() }
1302+
12841303/* *
12851304 * __Deprecated__:
12861305 *
@@ -1319,7 +1338,7 @@ public fun <T> Convert<T, String>.toInstant(): DataFrame<T> = asColumn { it.conv
13191338 *
13201339 * ### Examples:
13211340 * ```kotlin
1322- * df.convert { timestamp }.toInstant ()
1341+ * df.convert { timestamp }.toDeprecatedInstant ()
13231342 * ```
13241343 *
13251344 * Migrate to [kotlin.time.Instant] and use [convertToStdlibInstant] at your own pace.
@@ -1345,7 +1364,7 @@ public fun <T> Convert<T, String?>.toDeprecatedInstant(): DataFrame<T> = asColum
13451364 *
13461365 * ### Examples:
13471366 * ```kotlin
1348- * df.convert { timestamp }.toInstant ()
1367+ * df.convert { timestamp }.toDeprecatedInstant ()
13491368 * ```
13501369 *
13511370 * Migrate to [kotlin.time.Instant] and use [convertToStdlibInstant] at your own pace.
@@ -1364,20 +1383,20 @@ public fun <T> Convert<T, String?>.toDeprecatedInstant(): DataFrame<T> = asColum
13641383public fun <T > Convert <T , String >.toDeprecatedInstant (): DataFrame <T > = asColumn { it.convertToDeprecatedInstant() }
13651384
13661385/* *
1367- * Converts values in the [String] columns previously selected with [convert] to the [StdlibInstant ],
1386+ * Converts values in the [String] columns previously selected with [convert] to [kotlin.time.Instant ],
13681387 * preserving their original names and positions within the [DataFrame].
13691388 * Preserves null values.
13701389 *
13711390 * For more information: [See `convert` on the documentation website.](https://kotlin.github.io/dataframe/convert.html)
13721391 *
13731392 * ### Examples:
13741393 * ```kotlin
1375- * df.convert { timestamp }.toInstant ()
1394+ * df.convert { timestamp }.toStdlibInstant ()
13761395 * ```
13771396 *
13781397 * This function will be renamed to `.toInstant()` in 1.1.
13791398 *
1380- * @return A new [DataFrame] with the values converted to [StdlibInstant ].
1399+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant ].
13811400 */
13821401@JvmName(" toStdlibInstantFromStringNullable" )
13831402@Refine
@@ -1386,26 +1405,64 @@ public fun <T> Convert<T, String>.toDeprecatedInstant(): DataFrame<T> = asColumn
13861405public fun <T > Convert <T , String ?>.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
13871406
13881407/* *
1389- * Converts values in the [String] columns previously selected with [convert] to the [StdlibInstant ],
1408+ * Converts values in the [String] columns previously selected with [convert] to [kotlin.time.Instant ],
13901409 * preserving their original names and positions within the [DataFrame].
13911410 *
13921411 * For more information: [See `convert` on the documentation website.](https://kotlin.github.io/dataframe/convert.html)
13931412 *
13941413 * ### Examples:
13951414 * ```kotlin
1396- * df.convert { timestamp }.toInstant ()
1415+ * df.convert { timestamp }.toStdlibInstant ()
13971416 * ```
13981417 *
13991418 * This function will be renamed to `.toInstant()` in 1.1.
14001419 *
1401- * @return A new [DataFrame] with the values converted to [StdlibInstant ].
1420+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant ].
14021421 */
14031422@JvmName(" toStdlibInstantFromString" )
14041423@Refine
14051424@Converter(StdlibInstant ::class , nullable = false )
14061425@Interpretable(" ToSpecificType" )
14071426public fun <T > Convert <T , String >.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
14081427
1428+ /* *
1429+ * Converts values in the [kotlinx.datetime.Instant] columns previously selected with [convert] to [kotlin.time.Instant],
1430+ * preserving their original names and positions within the [DataFrame].
1431+ * Preserves null values.
1432+ *
1433+ * For more information: [See `convert` on the documentation website.](https://kotlin.github.io/dataframe/convert.html)
1434+ *
1435+ * ### Examples:
1436+ * ```kotlin
1437+ * df.convert { timestamp }.toStdlibInstant()
1438+ * ```
1439+ *
1440+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant].
1441+ */
1442+ @JvmName(" toStdlibInstantFromDeprecatedInstantNullable" )
1443+ @Refine
1444+ @Converter(StdlibInstant ::class , nullable = true )
1445+ @Interpretable(" ToSpecificType" )
1446+ public fun <T > Convert <T , DeprecatedInstant ?>.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
1447+
1448+ /* *
1449+ * Converts values in the [kotlinx.datetime.Instant] columns previously selected with [convert] to the [kotlin.time.Instant],
1450+ * preserving their original names and positions within the [DataFrame].
1451+ *
1452+ * For more information: [See `convert` on the documentation website.](https://kotlin.github.io/dataframe/convert.html)
1453+ *
1454+ * ### Examples:
1455+ * ```kotlin
1456+ * df.convert { timestamp }.toStdlibInstant()
1457+ * ```
1458+ *
1459+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant].
1460+ */
1461+ @JvmName(" toStdlibInstantFromDeprecatedInstant" )
1462+ @Refine
1463+ @Converter(StdlibInstant ::class , nullable = false )
1464+ @Interpretable(" ToSpecificType" )
1465+ public fun <T > Convert <T , DeprecatedInstant >.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
14091466// endregion
14101467
14111468// region toLocalDate
0 commit comments