isYesterday static method

bool isYesterday(
  1. DateTime dateTime,
  2. DateTime locDateTime
)

is yesterday by dateTime. 是否是昨天.

Implementation

static bool isYesterday(DateTime dateTime, DateTime locDateTime) {
  if (yearIsEqual(dateTime, locDateTime)) {
    int spDay = getDayOfYear(locDateTime) - getDayOfYear(dateTime);
    return spDay == 1;
  } else {
    return ((locDateTime.year - dateTime.year == 1) &&
        dateTime.month == 12 &&
        locDateTime.month == 1 &&
        dateTime.day == 31 &&
        locDateTime.day == 1);
  }
}