1
0
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:
Ferdinand Mütsch
2021-04-29 21:08:47 +02:00
parent 331ace3c1e
commit 37d4d58b57
5 changed files with 45 additions and 1 deletions

View File

@ -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))
}