kisThisWeek method
根据时间戳判断是否是本周
Implementation
bool kisThisWeek({bool isUtc = false}) {
var file = this;
if (file == null || file <= 0) {
return false;
}
DateTime oldDay = DateTime.fromMillisecondsSinceEpoch(file, isUtc: isUtc);
DateTime nowDat = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal();
DateTime old = nowDat.millisecondsSinceEpoch > oldDay.millisecondsSinceEpoch
? oldDay
: nowDat;
DateTime now = nowDat.millisecondsSinceEpoch > oldDay.millisecondsSinceEpoch
? nowDat
: oldDay;
return (now.weekday >= old.weekday) &&
(now.millisecondsSinceEpoch - old.millisecondsSinceEpoch <= 7 * oneDay);
}