Skip to content

Commit 28199fc

Browse files
authored
Merge pull request #965 from Cap-go/switch_to_utc_date_calc
feat: switch to UTC stats calculation
2 parents 1d58b13 + 0115b5a commit 28199fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/dashboard/Usage.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ async function getUsages() {
7070
cycleDay = currentDay
7171
}
7272
else {
73-
const cycleStartDay = cycleStart.getDate()
74-
const daysInMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0).getDate()
75-
cycleDay = (currentDay - cycleStartDay + 1 + daysInMonth) % daysInMonth
73+
const cycleStartDay = cycleStart.getUTCDate()
74+
const daysInMonth = new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth() + 1, 0)).getUTCDate()
75+
cycleDay = (currentDate.getUTCDate() - cycleStartDay + 1 + daysInMonth) % daysInMonth
7676
if (cycleDay === 0)
7777
cycleDay = daysInMonth
7878
}

0 commit comments

Comments
 (0)