truncateTo method

Hora truncateTo(
  1. TimePrecision precision
)

Truncates this date to the given precision.

Implementation

Hora truncateTo(TimePrecision precision) => switch (precision) {
      TimePrecision.year => Hora.of(year: year, utc: isUtc, locale: locale),
      TimePrecision.quarter => Hora.of(
          year: year,
          month: (quarter - 1) * 3 + 1,
          utc: isUtc,
          locale: locale,
        ),
      TimePrecision.month => Hora.of(
          year: year,
          month: month,
          utc: isUtc,
          locale: locale,
        ),
      TimePrecision.week => _truncateToIsoWeek(),
      TimePrecision.day => Hora.of(
          year: year,
          month: month,
          day: day,
          utc: isUtc,
          locale: locale,
        ),
      TimePrecision.hour => Hora.of(
          year: year,
          month: month,
          day: day,
          hour: hour,
          utc: isUtc,
          locale: locale,
        ),
      TimePrecision.minute => Hora.of(
          year: year,
          month: month,
          day: day,
          hour: hour,
          minute: minute,
          utc: isUtc,
          locale: locale,
        ),
      TimePrecision.second => Hora.of(
          year: year,
          month: month,
          day: day,
          hour: hour,
          minute: minute,
          second: second,
          utc: isUtc,
          locale: locale,
        ),
      TimePrecision.millisecond => Hora.of(
          year: year,
          month: month,
          day: day,
          hour: hour,
          minute: minute,
          second: second,
          millisecond: millisecond,
          utc: isUtc,
          locale: locale,
        ),
    };