@@ -448,6 +448,17 @@ public operator fun DateTimePeriod.plus(other: DateTimePeriod): DateTimePeriod =
448
448
safeAdd(totalNanoseconds, other.totalNanoseconds),
449
449
)
450
450
451
+ /* *
452
+ * Subtracts one [DateTimePeriod] instance from another.
453
+ *
454
+ * @throws DateTimeArithmeticException if arithmetic overflow happens.
455
+ */
456
+ public operator fun DateTimePeriod.minus (other : DateTimePeriod ) : DateTimePeriod = buildDateTimePeriod(
457
+ safeAdd(totalMonths, - other.totalMonths),
458
+ safeAdd(days, - other.days),
459
+ safeAdd(totalNanoseconds, - other.totalNanoseconds)
460
+ )
461
+
451
462
/* *
452
463
* Adds two [DatePeriod] instances.
453
464
*
@@ -457,3 +468,13 @@ public operator fun DatePeriod.plus(other: DatePeriod): DatePeriod = DatePeriod(
457
468
safeAdd(totalMonths, other.totalMonths),
458
469
safeAdd(days, other.days),
459
470
)
471
+
472
+ /* *
473
+ * Subtracts one [DatePeriod] instance from another.
474
+ *
475
+ * @throws DateTimeArithmeticException if arithmetic overflow happens.
476
+ */
477
+ public operator fun DatePeriod.minus (other : DatePeriod ): DatePeriod = DatePeriod (
478
+ safeAdd(totalMonths, - other.totalMonths),
479
+ safeAdd(days, - other.days)
480
+ )
0 commit comments