isSame method

bool isSame(
  1. Dayfl dayfl, [
  2. DateLocationEnum type = DateLocationEnum.millisecondsSinceEpoch
])

判断日期是否相同

dayfl 比较的对象

type 比较粒度单位 默认毫秒

Implementation

bool isSame(
  Dayfl dayfl, [
  DateLocationEnum type = DateLocationEnum.millisecondsSinceEpoch,
]) {
  bool _y = dayfl.year == _year;
  bool _mo = dayfl.month == _month;
  bool _d = dayfl.day == _day;
  bool _h = dayfl.hour == _hour;
  bool _m = dayfl.minute == _minute;
  bool _s = dayfl.second == _sec;

  if (type == DateLocationEnum.year) {
    return _y;
  } else if (type == DateLocationEnum.month) {
    return _y && _mo;
  } else if (type == DateLocationEnum.day) {
    return _y && _mo && _d;
  } else if (type == DateLocationEnum.hour) {
    return _y && _mo && _d && _h;
  } else if (type == DateLocationEnum.minute) {
    return _y && _mo && _d && _h && _m;
  } else if (type == DateLocationEnum.sec) {
    return _y && _mo && _d && _h && _m && _s;
  } else {
    return dayfl.dateTime == _datetime;
  }
}