Description:
In the profile view, filtering historical user stats (weekly or monthly views) excludes data points on the boundary date due to timezone/time-of-day offsets. The filter threshold filterDate is created using the client's local system time (e.g., new Date() minus 7/30 days). In contrast, user history records have dates stored in YYYY-MM-DD strings, which JavaScript parses as UTC midnight (00:00:00Z).
Because the local date has hours/minutes set, the condition new Date(item.date) >= filterDate evaluates to false for entries on the boundary day (since 00:00:00 is less than the current time of day, e.g., 10:30:00), causing boundary records to disappear depending on the hour of the day.
To Reproduce
- Register/log a user activity snapshot daily.
- View the weekly/monthly performance graphs on the profile page.
- Depending on the time of day, notice that the earliest boundary day data point is skipped from the graph.
Code Reference
In frontend/js/user/historical-graphs.js:
Suggested Fix
Normalize filterDate to start at local midnight:
if (filterDate) {
filterDate.setHours(0, 0, 0, 0);
}
---
Description:
In the profile view, filtering historical user stats (weekly or monthly views) excludes data points on the boundary date due to timezone/time-of-day offsets. The filter threshold
filterDateis created using the client's local system time (e.g.,new Date()minus 7/30 days). In contrast, user history records have dates stored inYYYY-MM-DDstrings, which JavaScript parses as UTC midnight (00:00:00Z).Because the local date has hours/minutes set, the condition
new Date(item.date) >= filterDateevaluates tofalsefor entries on the boundary day (since00:00:00is less than the current time of day, e.g.,10:30:00), causing boundary records to disappear depending on the hour of the day.To Reproduce
Code Reference
In
frontend/js/user/historical-graphs.js:Suggested Fix
Normalize
filterDateto start at local midnight: