Period constructor
const
Period({})
Creates a Period from human-friendly units.
All parameters default to 0. You can combine them freely:
Period(years: 1, months: 6) // ~1.5 years
Period(hours: 2, minutes: 30) // 2.5 hours
Period(days: 7) // one week
Months are approximated as 30 days, and years as 365 days.
Implementation
const Period({
int years = 0,
int months = 0,
int days = 0,
int hours = 0,
int minutes = 0,
int seconds = 0,
int milliseconds = 0,
int microseconds = 0,
}) : this._microseconds(
microseconds +
microsecondsPerMillisecond * milliseconds +
microsecondsPerSecond * seconds +
microsecondsPerMinute * minutes +
microsecondsPerHour * hours +
microsecondsPerDay * days +
microsecondsPerDay * 30 * months +
microsecondsPerDay * 365 * years,
);