operator - method
Subtracts one period from another, by simply subtracting each property value.
- this: The period to subtract the second operand from
other
: The period to subtract the first operand from
The result of subtracting all the values in the second operand from the values in the first. The units of the result will be the union of both periods, even if the subtraction caused some properties to become zero (so '2 weeks, 1 days' minus "2 weeks" is "zero weeks, 1 days", not "1 days").
Implementation
Period operator -(Period other) {
Preconditions.checkNotNull(other, 'other');
return Period(
years: years - other.years,
months: months - other.months,
weeks: weeks - other.weeks,
days: days - other.days,
hours: hours - other.hours,
minutes: minutes - other.minutes,
seconds: seconds - other.seconds,
milliseconds: milliseconds - other.milliseconds,
microseconds: microseconds - other.microseconds,
nanoseconds: nanoseconds - other.nanoseconds);
}