Skip to content

Commit 2db494c

Browse files
committed
Deprecate DatePeriod.plus and DateTimePeriod.plus
Fixes #381
1 parent 670a914 commit 2db494c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/common/src/DateTimePeriod.kt

+8
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,10 @@ public fun Duration.toDateTimePeriod(): DateTimePeriod = buildDateTimePeriod(tot
577577
*
578578
* @throws DateTimeArithmeticException if arithmetic overflow happens.
579579
*/
580+
@Deprecated(
581+
"Adding periods is not a well-defined operation. See https://github.com/Kotlin/kotlinx-datetime/issues/381",
582+
level = DeprecationLevel.ERROR
583+
)
580584
public operator fun DateTimePeriod.plus(other: DateTimePeriod): DateTimePeriod = buildDateTimePeriod(
581585
safeAdd(totalMonths, other.totalMonths),
582586
safeAdd(days, other.days),
@@ -591,6 +595,10 @@ public operator fun DateTimePeriod.plus(other: DateTimePeriod): DateTimePeriod =
591595
*
592596
* @throws DateTimeArithmeticException if arithmetic overflow happens.
593597
*/
598+
@Deprecated(
599+
"Adding periods is not a well-defined operation. See https://github.com/Kotlin/kotlinx-datetime/issues/381",
600+
level = DeprecationLevel.ERROR
601+
)
594602
public operator fun DatePeriod.plus(other: DatePeriod): DatePeriod = DatePeriod(
595603
safeAdd(totalMonths, other.totalMonths),
596604
safeAdd(days, other.days),

0 commit comments

Comments
 (0)