Skip to content

Commit 8810b1c

Browse files
authored
fix(testActivity): timezone edge case causing tests to appear on incorrect day (@fehmer) (monkeytypegame#6968)
steps to reproduce: - set the browsers timezone with minus offset that is greater then the current time utc (so new Date() will land on yesterday) - the easiest way to do this is to open dev tools, sensors and add a location with timezone `Pacific/Pago_Pago` which is UTC-11 - have a user with no activity for at least the last two days (utc) - remember the last activity in the chart, e,g, August 8th has five tests - the last day on the chart is yesterday - do a test - graph now shows one activity for yesterday - the remembered last activity is now shifted to e.g. August 7th with five tests fixed behaviour: - same setup as before - remember the last activity in the chart, e,g, August 8th has five tests - FIXED: the last day on the chart is today (in utc, so tomorrow in the users timezone) - do a test - FIXED graph shows one activity for today (in utc) - FIXED the remembered last activity is still on August 8th with five tests
1 parent fa03afe commit 8810b1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

frontend/src/ts/elements/test-activity-calendar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class TestActivityCalendar implements TestActivityCalendar {
5454
}
5555

5656
protected getInterval(lastDay: Date, fullYear = false): Interval {
57-
const end = fullYear ? endOfYear(lastDay) : new Date();
57+
const end = fullYear ? endOfYear(lastDay) : new UTCDateMini();
5858
let start = startOfYear(lastDay);
5959
if (!fullYear) {
6060
//show the last 52 weeks. Not using one year to avoid the graph to show 54 weeks

0 commit comments

Comments
 (0)