migrate consts/datetime.js to ts

This commit is contained in:
MaysWind
2025-01-02 00:31:28 +08:00
parent 5525635df1
commit ad9a390b58
22 changed files with 633 additions and 665 deletions
+3 -3
View File
@@ -196,7 +196,7 @@ import { useUserStore } from '@/stores/user.js';
import { useAccountsStore } from '@/stores/account.js';
import { useOverviewStore } from '@/stores/overview.js';
import datetimeConstants from '@/consts/datetime.js';
import { DateRange } from '@/core/datetime.ts';
import { ThemeType } from '@/core/theme.ts';
import {
formatUnixTime,
@@ -260,7 +260,7 @@ export default {
return this.userStore.currentUserDefaultCurrency;
},
allDateRanges() {
return datetimeConstants.allDateRanges;
return DateRange.all();
},
allAccounts() {
return this.accountsStore.allAccounts;
@@ -389,7 +389,7 @@ export default {
const maxTime = getUnixTimeBeforeUnixTime(getUnixTimeAfterUnixTime(minTime, 1, 'months'), 1, 'seconds');
const type = e.transactionType;
this.$router.push(`/transaction/list?type=${type}&dateType=${datetimeConstants.allDateRanges.Custom.type}&maxTime=${maxTime}&minTime=${minTime}`);
this.$router.push(`/transaction/list?type=${type}&dateType=${DateRange.Custom.type}&maxTime=${maxTime}&minTime=${minTime}`);
},
getDisplayCurrency(value, currencyCode) {
return this.$locale.formatAmountWithCurrency(this.settingsStore, this.userStore, value, currencyCode);