Skip to content

Active user count on deployment page has date off by one day #11943

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

Closed
aaronlehmann opened this issue Jan 30, 2024 · 2 comments · Fixed by #11962
Closed

Active user count on deployment page has date off by one day #11943

aaronlehmann opened this issue Jan 30, 2024 · 2 comments · Fixed by #11962
Assignees

Comments

@aaronlehmann
Copy link
Contributor

The graph of daily active users on the "Deployment" page always shows a date one day earlier than the current day for the latest data point (which appears to reflect the number for the current day). I don't think this is a time zone issue, since displaying the date in an inaccurate timezone would lead to an error in the opposite direction, but it might be something internal where the system attempts to compensate for timezones and overcorrects.

Possibly related: #7275

@cdr-bot cdr-bot bot added the bug label Jan 30, 2024
@Emyrk
Copy link
Member

Emyrk commented Jan 31, 2024

The issue is actually how the frontend converts dates (I think). If you look at the network requests response data, it does include "today".

This line makes the x axis labels

https://github.com/coder/coder/blob/multi-organization%2Fcreate-user/site/src/components/ActiveUserChart/ActiveUserChart.tsx#L57

If you run our dates through this function, it truncates to the previous day because the timestamp is UTC, and my timezone is behind.

console.log(dayjs('2024-01-31T00:00:00Z').format("YYYY-MM-DD"));
// 2024-01-30

@Emyrk
Copy link
Member

Emyrk commented Jan 31, 2024

The backend does this query:

-- name: GetTemplateDAUs :many

Which returns a Date and strips the timezone information (eg '2001-09-28'). We unmarshal that into a time.Time, which defaults to UTC.


I think the proper fix is to remove time information from the api. Return 2024-01-31 instead of '2024-01-31T00:00:00Z'. Then the javascript works as intended. I will fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants