@@ -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
@@ -1281,6 +1282,24 @@ public fun DataColumn<String>.convertToStdlibInstant(): DataColumn<StdlibInstant
1281
1282
public fun DataColumn<String?>.convertToStdlibInstant (): DataColumn <StdlibInstant ?> =
1282
1283
map { it?.let { StdlibInstant .parse(it) } }
1283
1284
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
+
1284
1303
/* *
1285
1304
* __Deprecated__:
1286
1305
*
@@ -1319,7 +1338,7 @@ public fun <T> Convert<T, String>.toInstant(): DataFrame<T> = asColumn { it.conv
1319
1338
*
1320
1339
* ### Examples:
1321
1340
* ```kotlin
1322
- * df.convert { timestamp }.toInstant ()
1341
+ * df.convert { timestamp }.toDeprecatedInstant ()
1323
1342
* ```
1324
1343
*
1325
1344
* 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
1345
1364
*
1346
1365
* ### Examples:
1347
1366
* ```kotlin
1348
- * df.convert { timestamp }.toInstant ()
1367
+ * df.convert { timestamp }.toDeprecatedInstant ()
1349
1368
* ```
1350
1369
*
1351
1370
* 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
1364
1383
public fun <T > Convert <T , String >.toDeprecatedInstant (): DataFrame <T > = asColumn { it.convertToDeprecatedInstant() }
1365
1384
1366
1385
/* *
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 ],
1368
1387
* preserving their original names and positions within the [DataFrame].
1369
1388
* Preserves null values.
1370
1389
*
1371
1390
* For more information: [See `convert` on the documentation website.](https://kotlin.github.io/dataframe/convert.html)
1372
1391
*
1373
1392
* ### Examples:
1374
1393
* ```kotlin
1375
- * df.convert { timestamp }.toInstant ()
1394
+ * df.convert { timestamp }.toStdlibInstant ()
1376
1395
* ```
1377
1396
*
1378
1397
* This function will be renamed to `.toInstant()` in 1.1.
1379
1398
*
1380
- * @return A new [DataFrame] with the values converted to [StdlibInstant ].
1399
+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant ].
1381
1400
*/
1382
1401
@JvmName(" toStdlibInstantFromStringNullable" )
1383
1402
@Refine
@@ -1386,26 +1405,64 @@ public fun <T> Convert<T, String>.toDeprecatedInstant(): DataFrame<T> = asColumn
1386
1405
public fun <T > Convert <T , String ?>.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
1387
1406
1388
1407
/* *
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 ],
1390
1409
* preserving their original names and positions within the [DataFrame].
1391
1410
*
1392
1411
* For more information: [See `convert` on the documentation website.](https://kotlin.github.io/dataframe/convert.html)
1393
1412
*
1394
1413
* ### Examples:
1395
1414
* ```kotlin
1396
- * df.convert { timestamp }.toInstant ()
1415
+ * df.convert { timestamp }.toStdlibInstant ()
1397
1416
* ```
1398
1417
*
1399
1418
* This function will be renamed to `.toInstant()` in 1.1.
1400
1419
*
1401
- * @return A new [DataFrame] with the values converted to [StdlibInstant ].
1420
+ * @return A new [DataFrame] with the values converted to [kotlin.time.Instant ].
1402
1421
*/
1403
1422
@JvmName(" toStdlibInstantFromString" )
1404
1423
@Refine
1405
1424
@Converter(StdlibInstant ::class , nullable = false )
1406
1425
@Interpretable(" ToSpecificType" )
1407
1426
public fun <T > Convert <T , String >.toStdlibInstant (): DataFrame <T > = asColumn { it.convertToStdlibInstant() }
1408
1427
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() }
1409
1466
// endregion
1410
1467
1411
1468
// region toLocalDate
0 commit comments