isSameAs method

bool isSameAs(
  1. Hora other, {
  2. required TimePrecision precision,
})

Checks if this date is the same as another with the given precision.

Implementation

bool isSameAs(Hora other, {required TimePrecision precision}) =>
    switch (precision) {
      TimePrecision.year => year == other.year,
      TimePrecision.quarter => year == other.year && quarter == other.quarter,
      TimePrecision.month => year == other.year && month == other.month,
      TimePrecision.week =>
        isoWeekYear == other.isoWeekYear && isoWeek == other.isoWeek,
      TimePrecision.day =>
        year == other.year && month == other.month && day == other.day,
      TimePrecision.hour => year == other.year &&
          month == other.month &&
          day == other.day &&
          hour == other.hour,
      TimePrecision.minute => year == other.year &&
          month == other.month &&
          day == other.day &&
          hour == other.hour &&
          minute == other.minute,
      TimePrecision.second => year == other.year &&
          month == other.month &&
          day == other.day &&
          hour == other.hour &&
          minute == other.minute &&
          second == other.second,
      TimePrecision.millisecond => unixMillis == other.unixMillis,
    };