isToday static method

bool isToday(
  1. int? milliseconds, {
  2. bool isUtc = false,
  3. int? locMs,
})

is today. 是否是当天.

Implementation

static bool isToday(int? milliseconds, {bool isUtc = false, int? locMs}) {
  if (milliseconds == null || milliseconds == 0) return false;
  DateTime old =
      DateTime.fromMillisecondsSinceEpoch(milliseconds, isUtc: isUtc);
  DateTime now;
  if (locMs != null) {
    now = DateUtil.getDateTimeByMs(locMs);
  } else {
    now = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal();
  }
  return old.year == now.year && old.month == now.month && old.day == now.day;
}