use the preset name if custom date range matches a preset item

This commit is contained in:
MaysWind
2024-06-03 00:47:39 +08:00
parent 809172bf34
commit 72f6a9e9a3
5 changed files with 31 additions and 11 deletions
@@ -261,6 +261,7 @@ import statisticsConstants from '@/consts/statistics.js';
import { getNameByKeyValue, limitText, formatPercent } from '@/lib/common.js'
import {
getShiftedDateRangeAndDateType,
getDateTypeByDateRange,
getDateRangeByDateType
} from '@/lib/datetime.js';
import { scrollToSelectedItem } from '@/lib/ui.mobile.js';
@@ -492,8 +493,10 @@ export default {
return;
}
const chartDateType = getDateTypeByDateRange(startTime, endTime, this.firstDayOfWeek, datetimeConstants.allDateRangeScenes.Normal);
this.statisticsStore.updateTransactionStatisticsFilter({
categoricalChartDateType: this.allDateRanges.Custom.type,
categoricalChartDateType: chartDateType,
categoricalChartStartTime: startTime,
categoricalChartEndTime: endTime
});
+4 -1
View File
@@ -439,6 +439,7 @@ import {
getBrowserTimezoneOffsetMinutes,
getActualUnixTimeForStore,
getShiftedDateRangeAndDateType,
getDateTypeByDateRange,
getDateRangeByDateType
} from '@/lib/datetime.js';
import { categoryTypeToTransactionType, transactionTypeToCategoryType } from '@/lib/category.js';
@@ -720,8 +721,10 @@ export default {
return;
}
const dateType = getDateTypeByDateRange(minTime, maxTime, this.firstDayOfWeek, datetimeConstants.allDateRangeScenes.Normal);
this.transactionsStore.updateTransactionListFilter({
dateType: this.allDateRanges.Custom.type,
dateType: dateType,
maxTime: maxTime,
minTime: minTime
});