mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: make wakatime summary endpoint date range inclusive (resolve #192)
This commit is contained in:
@ -13,6 +13,18 @@ func StartOfToday(tz *time.Location) time.Time {
|
||||
return StartOfDay(FloorDate(time.Now().In(tz)))
|
||||
}
|
||||
|
||||
func EndOfDay(date time.Time) time.Time {
|
||||
floored := FloorDate(date)
|
||||
if floored == date {
|
||||
date = date.Add(1 * time.Second)
|
||||
}
|
||||
return CeilDate(date)
|
||||
}
|
||||
|
||||
func EndOfToday(tz *time.Location) time.Time {
|
||||
return EndOfDay(time.Now().In(tz))
|
||||
}
|
||||
|
||||
func StartOfThisWeek(tz *time.Location) time.Time {
|
||||
return StartOfWeek(time.Now().In(tz))
|
||||
}
|
||||
|
Reference in New Issue
Block a user