feat: use utc during balance bar calcs (#4875)

This commit is contained in:
Calum H.
2025-12-09 08:44:04 +00:00
committed by GitHub
parent d5b7ac3542
commit 4fbbc2b1cf
2 changed files with 4 additions and 2 deletions

View File

@@ -418,14 +418,14 @@ const processingDate = computed<{ date: string; amount: number }>(() => {
const nextDates = nextDate.value
if (!nextDates.length) return { date: '', amount: 0 }
const now = dayjs()
const now = dayjs.utc()
const currentMonth = now.format('YYYY-MM')
// Find revenue from the current month (still "processing")
// Revenue earned in month X becomes available at end_of_month(X) + 60 days
// So we calculate: source_month = (date_available - 60 days).startOf('month')
for (const { date, amount } of nextDates) {
const availableDate = dayjs(date)
const availableDate = dayjs.utc(date)
const sourceMonthEnd = availableDate.subtract(60, 'days')
const sourceMonth = sourceMonthEnd.startOf('month').format('YYYY-MM')

View File

@@ -2,9 +2,11 @@ import dayjs from 'dayjs'
import advanced from 'dayjs/plugin/advancedFormat'
import quarterOfYear from 'dayjs/plugin/quarterOfYear'
import relativeTime from 'dayjs/plugin/relativeTime'
import utc from 'dayjs/plugin/utc'
dayjs.extend(quarterOfYear)
dayjs.extend(advanced)
dayjs.extend(utc)
dayjs.extend(relativeTime)
export default defineNuxtPlugin(() => {