@@ -5,6 +5,7 @@ import kotlinx.datetime.LocalDateTime
5
5
import kotlinx.datetime.LocalTime
6
6
import kotlinx.datetime.TimeZone
7
7
import kotlinx.datetime.toLocalDateTime
8
+ import kotlinx.datetime.toStdlibInstant
8
9
import org.jetbrains.kotlinx.dataframe.AnyBaseCol
9
10
import org.jetbrains.kotlinx.dataframe.AnyCol
10
11
import org.jetbrains.kotlinx.dataframe.AnyFrame
@@ -1128,6 +1129,24 @@ public fun DataColumn<String>.convertToStdlibInstant(): DataColumn<StdlibInstant
1128
1129
public fun DataColumn<String?>.convertToStdlibInstant (): DataColumn <StdlibInstant ?> =
1129
1130
map { it?.let { StdlibInstant .parse(it) } }
1130
1131
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
+
1131
1150
/* *
1132
1151
* __Deprecated__:
1133
1152
*
@@ -1166,7 +1185,7 @@ public fun <T> Convert<T, String>.toInstant(): DataFrame<T> = asColumn { it.conv
1166
1185
*
1167
1186
* ### Examples:
1168
1187
* ```kotlin
1169
- * df.convert { timestamp }.toInstant ()
1188
+ * df.convert { timestamp }.toDeprecatedInstant ()
1170
1189
* ```
1171
1190
*
1172
1191
* 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
1192
1211
*
1193
1212
* ### Examples:
1194
1213
* ```kotlin
1195
- * df.convert { timestamp }.toInstant ()
1214
+ * df.convert { timestamp }.toDeprecatedInstant ()
1196
1215
* ```
1197
1216
*
1198
1217
* 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
1211
1230
public fun <T > Convert <T , String >.toDeprecatedInstant (): DataFrame <T > = asColumn { it.convertToDeprecatedInstant() }
1212
1231
1213
1232
/* *
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 ],
1215
1234
* preserving their original names and positions within the [DataFrame].
1216
1235
* Preserves null values.
1217
1236
*
1218
1237
* For more information: {@include [DocumentationUrls.Convert]}
1219
1238
*
1220
1239
* ### Examples:
1221
1240
* ```kotlin
1222
- * df.convert { timestamp }.toInstant ()
1241
+ * df.convert { timestamp }.toStdlibInstant ()
1223
1242
* ```
1224
1243
*
1225
1244
* This function will be renamed to `.toInstant()` in 1.1.
1226
1245
*
1227
- * @return A new [DataFrame] with the values converted to [StdlibInstant ].
1246
+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant ].
1228
1247
*/
1229
1248
@JvmName(" toStdlibInstantFromStringNullable" )
1230
1249
@Refine
@@ -1233,26 +1252,64 @@ public fun <T> Convert<T, String>.toDeprecatedInstant(): DataFrame<T> = asColumn
1233
1252
public fun <T > Convert <T , String ?>.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
1234
1253
1235
1254
/* *
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 ],
1237
1256
* preserving their original names and positions within the [DataFrame].
1238
1257
*
1239
1258
* For more information: {@include [DocumentationUrls.Convert]}
1240
1259
*
1241
1260
* ### Examples:
1242
1261
* ```kotlin
1243
- * df.convert { timestamp }.toInstant ()
1262
+ * df.convert { timestamp }.toStdlibInstant ()
1244
1263
* ```
1245
1264
*
1246
1265
* This function will be renamed to `.toInstant()` in 1.1.
1247
1266
*
1248
- * @return A new [DataFrame] with the values converted to [StdlibInstant ].
1267
+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant ].
1249
1268
*/
1250
1269
@JvmName(" toStdlibInstantFromString" )
1251
1270
@Refine
1252
1271
@Converter(StdlibInstant ::class , nullable = false )
1253
1272
@Interpretable(" ToSpecificType" )
1254
1273
public fun <T > Convert <T , String >.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
1255
1274
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() }
1256
1313
// endregion
1257
1314
1258
1315
// region toLocalDate
0 commit comments