Skip to content

feat(coderd): support weekly aggregated insights #9684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Sep 19, 2023
Prev Previous commit
Next Next commit
Sydney location
  • Loading branch information
mtojek committed Sep 18, 2023
commit fa1ad6219e659ac6ce6ecd76aa1949a439467ad1
9 changes: 6 additions & 3 deletions coderd/insights_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,14 @@ func Test_parseInsightsInterval_week(t *testing.T) {
t.Parallel()

layout := insightsTimeLayout
now := time.Now().UTC()
sydneyLoc, err := time.LoadLocation("Australia/Sydney") // Random location
require.NoError(t, err)

now := time.Now()
y, m, d := now.Date()
today := time.Date(y, m, d, 0, 0, 0, 0, time.UTC)
today := time.Date(y, m, d, 0, 0, 0, 0, sydneyLoc)

thisHour := time.Date(y, m, d, now.Hour(), 0, 0, 0, time.UTC)
thisHour := time.Date(y, m, d, now.Hour(), 0, 0, 0, sydneyLoc)
twoHoursAgo := thisHour.Add(-2 * time.Hour)
thirteenDaysAgo := today.AddDate(0, 0, -13)

Expand Down