casualConversion top-level constant
UnitConversion
const casualConversion
Casual conversion scheme from different TimeUnits to microseconds.
This naive conversion assumes that a month has 30 days and a year has 365 days. While this is the default for all operations, it is not typically correct or event consistent.
Implementation
const UnitConversion casualConversion = {
TimeUnit.microsecond: 1,
TimeUnit.millisecond: Duration.microsecondsPerMillisecond,
TimeUnit.second: Duration.microsecondsPerSecond,
TimeUnit.minute: Duration.microsecondsPerMinute,
TimeUnit.hour: Duration.microsecondsPerHour,
TimeUnit.day: Duration.microsecondsPerDay,
TimeUnit.week: 7 * Duration.microsecondsPerDay,
TimeUnit.month: 30 * Duration.microsecondsPerDay,
TimeUnit.quarter: 3 * 30 * Duration.microsecondsPerDay,
TimeUnit.year: 365 * Duration.microsecondsPerDay,
TimeUnit.decade: 10 * 365 * Duration.microsecondsPerDay,
TimeUnit.century: 100 * 365 * Duration.microsecondsPerDay,
TimeUnit.millennium: 1000 * 365 * Duration.microsecondsPerDay,
};