forked from didirus/AstralRinth
feat: use utc during balance bar calcs (#4875)
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user