truncateTo method
Truncates this date to the given precision.
Implementation
Hora truncateTo(TimePrecision precision) => switch (precision) {
TimePrecision.year => Hora.of(year: year, locale: locale),
TimePrecision.quarter => Hora.of(
year: year,
month: (quarter - 1) * 3 + 1,
locale: locale,
),
TimePrecision.month =>
Hora.of(year: year, month: month, locale: locale),
TimePrecision.week => startOf(TemporalUnit.week),
TimePrecision.day => Hora.of(
year: year,
month: month,
day: day,
locale: locale,
),
TimePrecision.hour => Hora.of(
year: year,
month: month,
day: day,
hour: hour,
locale: locale,
),
TimePrecision.minute => Hora.of(
year: year,
month: month,
day: day,
hour: hour,
minute: minute,
locale: locale,
),
TimePrecision.second => Hora.of(
year: year,
month: month,
day: day,
hour: hour,
minute: minute,
second: second,
locale: locale,
),
TimePrecision.millisecond => this,
};