@@ -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
@@ -1128,6 +1129,24 @@ public fun DataColumn<String>.convertToStdlibInstant(): DataColumn<StdlibInstant
11281129public fun DataColumn<String?>.convertToStdlibInstant (): DataColumn <StdlibInstant ?> =
11291130 map { it?.let { StdlibInstant .parse(it) } }
11301131
1132+ /* *
1133+ * Converts values in this [kotlinx.datetime.Instant] column to [kotlin.time.Instant].
1134+ *
1135+ * @return A new [DataColumn] with the [kotlin.time.Instant] values.
1136+ */
1137+ @JvmName(" convertToStdlibInstantFromDeprecatedInstant" )
1138+ public fun DataColumn<DeprecatedInstant>.convertToStdlibInstant (): DataColumn <StdlibInstant > =
1139+ map { it.toStdlibInstant() }
1140+
1141+ /* *
1142+ * Converts values in this [kotlinx.datetime.Instant] column to [kotlin.time.Instant]. Preserves null values.
1143+ *
1144+ * @return A new [DataColumn] with the [kotlin.time.Instant] nullable values.
1145+ */
1146+ @JvmName(" convertToStdlibInstantFromDeprecatedInstantNullable" )
1147+ public fun DataColumn<DeprecatedInstant?>.convertToStdlibInstant (): DataColumn <StdlibInstant ?> =
1148+ map { it?.toStdlibInstant() }
1149+
11311150/* *
11321151 * __Deprecated__:
11331152 *
@@ -1166,7 +1185,7 @@ public fun <T> Convert<T, String>.toInstant(): DataFrame<T> = asColumn { it.conv
11661185 *
11671186 * ### Examples:
11681187 * ```kotlin
1169- * df.convert { timestamp }.toInstant ()
1188+ * df.convert { timestamp }.toDeprecatedInstant ()
11701189 * ```
11711190 *
11721191 * Migrate to [kotlin.time.Instant] and use [convertToStdlibInstant] at your own pace.
@@ -1192,7 +1211,7 @@ public fun <T> Convert<T, String?>.toDeprecatedInstant(): DataFrame<T> = asColum
11921211 *
11931212 * ### Examples:
11941213 * ```kotlin
1195- * df.convert { timestamp }.toInstant ()
1214+ * df.convert { timestamp }.toDeprecatedInstant ()
11961215 * ```
11971216 *
11981217 * Migrate to [kotlin.time.Instant] and use [convertToStdlibInstant] at your own pace.
@@ -1211,20 +1230,20 @@ public fun <T> Convert<T, String?>.toDeprecatedInstant(): DataFrame<T> = asColum
12111230public fun <T > Convert <T , String >.toDeprecatedInstant (): DataFrame <T > = asColumn { it.convertToDeprecatedInstant() }
12121231
12131232/* *
1214- * Converts values in the [String] columns previously selected with [convert] to the [StdlibInstant ],
1233+ * Converts values in the [String] columns previously selected with [convert] to [kotlin.time.Instant ],
12151234 * preserving their original names and positions within the [DataFrame].
12161235 * Preserves null values.
12171236 *
12181237 * For more information: {@include [DocumentationUrls.Convert]}
12191238 *
12201239 * ### Examples:
12211240 * ```kotlin
1222- * df.convert { timestamp }.toInstant ()
1241+ * df.convert { timestamp }.toStdlibInstant ()
12231242 * ```
12241243 *
12251244 * This function will be renamed to `.toInstant()` in 1.1.
12261245 *
1227- * @return A new [DataFrame] with the values converted to [StdlibInstant ].
1246+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant ].
12281247 */
12291248@JvmName(" toStdlibInstantFromStringNullable" )
12301249@Refine
@@ -1233,26 +1252,64 @@ public fun <T> Convert<T, String>.toDeprecatedInstant(): DataFrame<T> = asColumn
12331252public fun <T > Convert <T , String ?>.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
12341253
12351254/* *
1236- * Converts values in the [String] columns previously selected with [convert] to the [StdlibInstant ],
1255+ * Converts values in the [String] columns previously selected with [convert] to [kotlin.time.Instant ],
12371256 * preserving their original names and positions within the [DataFrame].
12381257 *
12391258 * For more information: {@include [DocumentationUrls.Convert]}
12401259 *
12411260 * ### Examples:
12421261 * ```kotlin
1243- * df.convert { timestamp }.toInstant ()
1262+ * df.convert { timestamp }.toStdlibInstant ()
12441263 * ```
12451264 *
12461265 * This function will be renamed to `.toInstant()` in 1.1.
12471266 *
1248- * @return A new [DataFrame] with the values converted to [StdlibInstant ].
1267+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant ].
12491268 */
12501269@JvmName(" toStdlibInstantFromString" )
12511270@Refine
12521271@Converter(StdlibInstant ::class , nullable = false )
12531272@Interpretable(" ToSpecificType" )
12541273public fun <T > Convert <T , String >.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
12551274
1275+ /* *
1276+ * Converts values in the [kotlinx.datetime.Instant] columns previously selected with [convert] to [kotlin.time.Instant],
1277+ * preserving their original names and positions within the [DataFrame].
1278+ * Preserves null values.
1279+ *
1280+ * For more information: {@include [DocumentationUrls.Convert]}
1281+ *
1282+ * ### Examples:
1283+ * ```kotlin
1284+ * df.convert { timestamp }.toStdlibInstant()
1285+ * ```
1286+ *
1287+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant].
1288+ */
1289+ @JvmName(" toStdlibInstantFromDeprecatedInstantNullable" )
1290+ @Refine
1291+ @Converter(StdlibInstant ::class , nullable = true )
1292+ @Interpretable(" ToSpecificType" )
1293+ public fun <T > Convert <T , DeprecatedInstant ?>.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
1294+
1295+ /* *
1296+ * Converts values in the [kotlinx.datetime.Instant] columns previously selected with [convert] to the [kotlin.time.Instant],
1297+ * preserving their original names and positions within the [DataFrame].
1298+ *
1299+ * For more information: {@include [DocumentationUrls.Convert]}
1300+ *
1301+ * ### Examples:
1302+ * ```kotlin
1303+ * df.convert { timestamp }.toStdlibInstant()
1304+ * ```
1305+ *
1306+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant].
1307+ */
1308+ @JvmName(" toStdlibInstantFromDeprecatedInstant" )
1309+ @Refine
1310+ @Converter(StdlibInstant ::class , nullable = false )
1311+ @Interpretable(" ToSpecificType" )
1312+ public fun <T > Convert <T , DeprecatedInstant >.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
12561313// endregion
12571314
12581315// region toLocalDate
0 commit comments