getWeeksDate static method
当前时间 过去/未来 某个周的周一和周日
Implementation
static getWeeksDate(int weeks) {
Map<String, String> mapTime = new Map();
DateTime now = new DateTime.now();
int weekday = now.weekday; //今天周几
var sunDay = getTimestampLatest(false, 7 - weekday + weeks * 7); //周末
var monDay = getTimestampLatest(true, -weekday + 1 + weeks * 7); //周一
mapTime['monDay'] = DateUtil.formatDate(DateTime.fromMillisecondsSinceEpoch(sunDay), format: 'yyyy-MM-dd'); //周一 时间格式化
mapTime['sunDay'] = DateUtil.formatDate(DateTime.fromMillisecondsSinceEpoch(monDay), format: 'yyyy-MM-dd'); //周一 时间格式化
mapTime['monDayStamp'] = '$monDay'; //周一 时间戳
mapTime['sunDayStamp'] = '$sunDay'; //周日 时间戳
print('某个周的周一和周日:$mapTime');
return mapTime;
}