Skip to content

Commit

Permalink
report end date correction for current month/year
Browse files Browse the repository at this point in the history
  • Loading branch information
howeyc committed Jun 30, 2018
1 parent 5e8ca1b commit e31b042
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cmd/lweb/handler_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,40 @@ func getRangeAndPeriod(dateRange, dateFreq string) (start, end time.Time, period
currentTime := time.Now()
switch dateRange {
case "All Time":
end = currentTime.Add(time.Hour * 24)
end = time.Date(currentTime.Year()+1, time.January, 1, 0, 0, 0, 0, time.UTC)
case "Last Ten Years":
start = time.Date(currentTime.Year()-9, time.January, 1, 0, 0, 0, 0, time.UTC)
end = currentTime.Add(time.Hour * 24)
end = time.Date(currentTime.Year()+1, time.January, 1, 0, 0, 0, 0, time.UTC)
case "Last Five Years":
start = time.Date(currentTime.Year()-4, time.January, 1, 0, 0, 0, 0, time.UTC)
end = currentTime.Add(time.Hour * 24)
end = time.Date(currentTime.Year()+1, time.January, 1, 0, 0, 0, 0, time.UTC)
case "Last Three Years":
start = time.Date(currentTime.Year()-2, time.January, 1, 0, 0, 0, 0, time.UTC)
end = currentTime.Add(time.Hour * 24)
end = time.Date(currentTime.Year()+1, time.January, 1, 0, 0, 0, 0, time.UTC)
case "Last Two Years":
start = time.Date(currentTime.Year()-1, time.January, 1, 0, 0, 0, 0, time.UTC)
end = currentTime.Add(time.Hour * 24)
end = time.Date(currentTime.Year()+1, time.January, 1, 0, 0, 0, 0, time.UTC)
case "YTD", "Current Year":
start = time.Date(currentTime.Year(), time.January, 1, 0, 0, 0, 0, time.UTC)
end = currentTime.Add(time.Hour * 24)
end = time.Date(currentTime.Year()+1, time.January, 1, 0, 0, 0, 0, time.UTC)
case "Previous Year", "Last Year":
start = time.Date(currentTime.Year()-1, time.January, 1, 0, 0, 0, 0, time.UTC)
end = time.Date(currentTime.Year(), time.January, 1, 0, 0, 0, 0, time.UTC)
case "Last Five Months":
start = time.Date(currentTime.Year(), currentTime.Month()-4, 1, 0, 0, 0, 0, time.UTC)
end = currentTime.Add(time.Hour * 24)
end = time.Date(currentTime.Year(), currentTime.Month()+1, 1, 0, 0, 0, 0, time.UTC)
case "Last Three Months":
start = time.Date(currentTime.Year(), currentTime.Month()-2, 1, 0, 0, 0, 0, time.UTC)
end = currentTime.Add(time.Hour * 24)
end = time.Date(currentTime.Year(), currentTime.Month()+1, 1, 0, 0, 0, 0, time.UTC)
case "Last Two Months":
start = time.Date(currentTime.Year(), currentTime.Month()-1, 1, 0, 0, 0, 0, time.UTC)
end = currentTime.Add(time.Hour * 24)
end = time.Date(currentTime.Year(), currentTime.Month()+1, 1, 0, 0, 0, 0, time.UTC)
case "Previous Month", "Last Month":
start = time.Date(currentTime.Year(), currentTime.Month()-1, 1, 0, 0, 0, 0, time.UTC)
end = time.Date(currentTime.Year(), currentTime.Month(), 1, 0, 0, 0, 0, time.UTC)
case "Current Month":
start = time.Date(currentTime.Year(), currentTime.Month(), 1, 0, 0, 0, 0, time.UTC)
end = currentTime.Add(time.Hour * 24)
end = time.Date(currentTime.Year(), currentTime.Month()+1, 1, 0, 0, 0, 0, time.UTC)
case "Current Quarter":
switch currentTime.Month() {
case time.January, time.February, time.March:
Expand Down

0 comments on commit e31b042

Please sign in to comment.