1.优化获取上月时间,上周时间的截止时间,从"00:00:00"改为"23:59:59";
This commit is contained in:
parent
1025336d2a
commit
7e1dc4646b
|
@ -2809,7 +2809,12 @@ func GetLastWeekRange() (time.Time, time.Time) {
|
||||||
return time.Date(year, month, day, 0, 0, 0, 0, t.Location())
|
return time.Date(year, month, day, 0, 0, 0, 0, t.Location())
|
||||||
}
|
}
|
||||||
|
|
||||||
return startOfDay(lastWeekStart), startOfDay(lastWeekEnd)
|
endOfDay := func(t time.Time) time.Time {
|
||||||
|
year, month, day := t.Date()
|
||||||
|
return time.Date(year, month, day, 23, 59, 59, 0, t.Location())
|
||||||
|
}
|
||||||
|
|
||||||
|
return startOfDay(lastWeekStart), endOfDay(lastWeekEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLastMonthRange 获取上个月的时间范围
|
// GetLastMonthRange 获取上个月的时间范围
|
||||||
|
@ -2818,6 +2823,8 @@ func GetLastMonthRange() (time.Time, time.Time) {
|
||||||
year, month, _ := now.Date()
|
year, month, _ := now.Date()
|
||||||
firstDay := time.Date(year, month-1, 1, 0, 0, 0, 0, now.Location())
|
firstDay := time.Date(year, month-1, 1, 0, 0, 0, 0, now.Location())
|
||||||
lastDay := firstDay.AddDate(0, 1, -1)
|
lastDay := firstDay.AddDate(0, 1, -1)
|
||||||
|
lastDay = time.Date(lastDay.Year(), lastDay.Month(), lastDay.Day(), 23, 59, 59, 0, now.Location())
|
||||||
|
|
||||||
return firstDay, lastDay
|
return firstDay, lastDay
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user