fix incorrect display when use transaction year-quarter as axis / category / series in insights explorer
This commit is contained in:
@@ -183,6 +183,7 @@ import {
|
|||||||
} from '@/stores/explorer.ts';
|
} from '@/stores/explorer.ts';
|
||||||
|
|
||||||
import { type NameValue, type TypeAndDisplayName } from '@/core/base.ts';
|
import { type NameValue, type TypeAndDisplayName } from '@/core/base.ts';
|
||||||
|
import { NumeralSystem } from '@/core/numeral.ts';
|
||||||
import { Month, WeekDay } from '@/core/datetime.ts';
|
import { Month, WeekDay } from '@/core/datetime.ts';
|
||||||
import { ChartSortingType, ExportMermaidChartType } from '@/core/statistics.ts';
|
import { ChartSortingType, ExportMermaidChartType } from '@/core/statistics.ts';
|
||||||
import {
|
import {
|
||||||
@@ -468,7 +469,8 @@ function getCategoriedDataDisplayName(info: CategoriedInfo | SeriesInfo): string
|
|||||||
const parts = name.split('-');
|
const parts = name.split('-');
|
||||||
const year = parts.length === 2 ? parts[0] : '';
|
const year = parts.length === 2 ? parts[0] : '';
|
||||||
const quarter = parts.length === 2 ? parseInt(parts[1] as string) : 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');
|
displayName = dateTime ? formatDateTimeToGregorianLikeYearQuarter(dateTime) : tt('Unknown');
|
||||||
} else if (dimession === TransactionExplorerDataDimension.DateTimeByYear.value) {
|
} else if (dimession === TransactionExplorerDataDimension.DateTimeByYear.value) {
|
||||||
const dateTime = parseDateTimeFromString(name, dimessionType);
|
const dateTime = parseDateTimeFromString(name, dimessionType);
|
||||||
|
|||||||
Reference in New Issue
Block a user