isToday static method
is today. 是否是当天.
只有 null 表示缺失值;epoch 0(1970-01-01)是合法时间戳,不再被
== 0 守卫误判为"无值"。
Implementation
static bool isToday(int? milliseconds, {bool isUtc = false, int? locMs}) {
if (milliseconds == null) return false;
final DateTime old =
DateTime.fromMillisecondsSinceEpoch(milliseconds, isUtc: isUtc);
DateTime now;
if (locMs != null) {
now = getDateTimeByMs(locMs, isUtc: isUtc);
} else {
now = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal();
}
return old.year == now.year && old.month == now.month && old.day == now.day;
}