fix incorrect display when use transaction year-quarter as axis / category / series in insights explorer

This commit is contained in:
MaysWind
2026-03-07 22:23:37 +08:00
parent d517a1862b
commit 127bed1026
@@ -183,6 +183,7 @@ import {
} from '@/stores/explorer.ts';
import { type NameValue, type TypeAndDisplayName } from '@/core/base.ts';
import { NumeralSystem } from '@/core/numeral.ts';
import { Month, WeekDay } from '@/core/datetime.ts';
import { ChartSortingType, ExportMermaidChartType } from '@/core/statistics.ts';
import {
@@ -468,7 +469,8 @@ function getCategoriedDataDisplayName(info: CategoriedInfo | SeriesInfo): string
const parts = name.split('-');
const year = parts.length === 2 ? parts[0] : '';
const quarter = parts.length === 2 ? parseInt(parts[1] as string) : 0;
const dateTime = year && quarter ? parseDateTimeFromString(`${year}-${quarter * 3}`, TransactionExplorerDimensionType.YearMonth) : undefined;
const quarterLastMonth = quarter * 3;
const dateTime = year && quarterLastMonth ? parseDateTimeFromString(`${year}-${quarterLastMonth.toString(10).padStart(2, NumeralSystem.WesternArabicNumerals.digitZero)}`, TransactionExplorerDimensionType.YearMonth) : undefined;
displayName = dateTime ? formatDateTimeToGregorianLikeYearQuarter(dateTime) : tt('Unknown');
} else if (dimession === TransactionExplorerDataDimension.DateTimeByYear.value) {
const dateTime = parseDateTimeFromString(name, dimessionType);