Skip to content

Commit 4fbbc2b

Browse files
authored
feat: use utc during balance bar calcs (#4875)
1 parent d5b7ac3 commit 4fbbc2b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

apps/frontend/src/pages/dashboard/revenue/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,14 +418,14 @@ const processingDate = computed<{ date: string; amount: number }>(() => {
418418
const nextDates = nextDate.value
419419
if (!nextDates.length) return { date: '', amount: 0 }
420420
421-
const now = dayjs()
421+
const now = dayjs.utc()
422422
const currentMonth = now.format('YYYY-MM')
423423
424424
// Find revenue from the current month (still "processing")
425425
// Revenue earned in month X becomes available at end_of_month(X) + 60 days
426426
// So we calculate: source_month = (date_available - 60 days).startOf('month')
427427
for (const { date, amount } of nextDates) {
428-
const availableDate = dayjs(date)
428+
const availableDate = dayjs.utc(date)
429429
const sourceMonthEnd = availableDate.subtract(60, 'days')
430430
const sourceMonth = sourceMonthEnd.startOf('month').format('YYYY-MM')
431431

apps/frontend/src/plugins/dayjs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import dayjs from 'dayjs'
22
import advanced from 'dayjs/plugin/advancedFormat'
33
import quarterOfYear from 'dayjs/plugin/quarterOfYear'
44
import relativeTime from 'dayjs/plugin/relativeTime'
5+
import utc from 'dayjs/plugin/utc'
56

67
dayjs.extend(quarterOfYear)
78
dayjs.extend(advanced)
9+
dayjs.extend(utc)
810
dayjs.extend(relativeTime)
911

1012
export default defineNuxtPlugin(() => {

0 commit comments

Comments
 (0)