mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 09:14:27 +08:00
code refactor
This commit is contained in:
@@ -20,9 +20,9 @@ import type {
|
||||
export function useHomePageBase() {
|
||||
const {
|
||||
formatUnixTimeToLongDate,
|
||||
getCalendarLongYearFromUnixTime,
|
||||
getCalendarLongMonthFromUnixTime,
|
||||
getCalendarLongMonthDayFromUnixTime,
|
||||
formatUnixTimeToLongMonthDay,
|
||||
formatUnixTimeToGregorianLikeLongYear,
|
||||
formatUnixTimeToGregorianLikeLongMonth,
|
||||
formatAmountToLocalizedNumeralsWithCurrency
|
||||
} = useI18n();
|
||||
|
||||
@@ -60,16 +60,16 @@ export function useHomePageBase() {
|
||||
displayTime: formatUnixTimeToLongDate(overviewStore.transactionDataRange.today.startTime),
|
||||
},
|
||||
thisWeek: {
|
||||
startTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisWeek.startTime),
|
||||
endTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisWeek.endTime)
|
||||
startTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisWeek.startTime),
|
||||
endTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisWeek.endTime)
|
||||
},
|
||||
thisMonth: {
|
||||
displayTime: getCalendarLongMonthFromUnixTime(overviewStore.transactionDataRange.thisMonth.startTime),
|
||||
startTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisMonth.startTime),
|
||||
endTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisMonth.endTime)
|
||||
displayTime: formatUnixTimeToGregorianLikeLongMonth(overviewStore.transactionDataRange.thisMonth.startTime),
|
||||
startTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisMonth.startTime),
|
||||
endTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisMonth.endTime)
|
||||
},
|
||||
thisYear: {
|
||||
displayTime: getCalendarLongYearFromUnixTime(overviewStore.transactionDataRange.thisYear.startTime)
|
||||
displayTime: formatUnixTimeToGregorianLikeLongYear(overviewStore.transactionDataRange.thisYear.startTime)
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -31,10 +31,10 @@ export function useReconciliationStatementPageBase() {
|
||||
tt,
|
||||
getAllAccountBalanceTrendChartTypes,
|
||||
getAllStatisticsDateAggregationTypesWithShortName,
|
||||
formatUnixTimeToDefaultDateTimeWithoutLocaleOptions,
|
||||
formatUnixTimeToLongDateTime,
|
||||
formatUnixTimeToLongDate,
|
||||
formatUnixTimeToShortTime,
|
||||
formatUnixTimeToGregorianDefaultDateTime,
|
||||
formatAmountToWesternArabicNumeralsWithoutDigitGrouping,
|
||||
formatAmountToLocalizedNumeralsWithCurrency
|
||||
} = useI18n();
|
||||
@@ -241,7 +241,7 @@ export function useReconciliationStatementPageBase() {
|
||||
}
|
||||
|
||||
return [
|
||||
formatUnixTimeToDefaultDateTimeWithoutLocaleOptions(transactionTime),
|
||||
formatUnixTimeToGregorianDefaultDateTime(transactionTime),
|
||||
type,
|
||||
categoryName,
|
||||
displayAmount,
|
||||
|
||||
@@ -30,7 +30,7 @@ export function useStatisticsTransactionPageBase() {
|
||||
getAllStatisticsSortingTypes,
|
||||
getAllStatisticsDateAggregationTypes,
|
||||
formatUnixTimeToLongDateTime,
|
||||
getCalendarLongYearMonthFromUnixTime,
|
||||
formatUnixTimeToGregorianLikeLongYearMonth,
|
||||
formatDateRange,
|
||||
formatAmountToLocalizedNumeralsWithCurrency
|
||||
} = useI18n();
|
||||
@@ -76,7 +76,7 @@ export function useStatisticsTransactionPageBase() {
|
||||
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis) {
|
||||
return formatUnixTimeToLongDateTime(query.value.categoricalChartStartTime);
|
||||
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis) {
|
||||
return getCalendarLongYearMonthFromUnixTime(getYearMonthFirstUnixTime(query.value.trendChartStartYearMonth));
|
||||
return formatUnixTimeToGregorianLikeLongYearMonth(getYearMonthFirstUnixTime(query.value.trendChartStartYearMonth));
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
@@ -86,7 +86,7 @@ export function useStatisticsTransactionPageBase() {
|
||||
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis) {
|
||||
return formatUnixTimeToLongDateTime(query.value.categoricalChartEndTime);
|
||||
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis) {
|
||||
return getCalendarLongYearMonthFromUnixTime(getYearMonthLastUnixTime(query.value.trendChartEndYearMonth));
|
||||
return formatUnixTimeToGregorianLikeLongYearMonth(getYearMonthLastUnixTime(query.value.trendChartEndYearMonth));
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ export function useTransactionListPageBase() {
|
||||
getCurrentNumeralSystemType,
|
||||
formatUnixTimeToLongDateTime,
|
||||
formatUnixTimeToLongDate,
|
||||
getCalendarLongYearMonthFromUnixTime,
|
||||
formatUnixTimeToShortTime,
|
||||
formatUnixTimeToGregorianLikeLongYearMonth,
|
||||
formatDateRange,
|
||||
formatAmountToLocalizedNumeralsWithCurrency
|
||||
} = useI18n();
|
||||
@@ -287,7 +287,7 @@ export function useTransactionListPageBase() {
|
||||
}
|
||||
|
||||
function getDisplayLongYearMonth(transactionMonthList: TransactionMonthList): string {
|
||||
return getCalendarLongYearMonthFromUnixTime(getYearMonthFirstUnixTime(transactionMonthList.yearDashMonth));
|
||||
return formatUnixTimeToGregorianLikeLongYearMonth(getYearMonthFirstUnixTime(transactionMonthList.yearDashMonth));
|
||||
}
|
||||
|
||||
function getDisplayTimezone(transaction: Transaction): string {
|
||||
|
||||
@@ -63,7 +63,7 @@ const emit = defineEmits<{
|
||||
const {
|
||||
tt,
|
||||
getCurrentLanguageTextDirection,
|
||||
getCalendarShortMonthFromUnixTime,
|
||||
formatUnixTimeToGregorianLikeShortMonth,
|
||||
formatAmountToLocalizedNumeralsWithCurrency
|
||||
} = useI18n();
|
||||
|
||||
@@ -101,7 +101,7 @@ const chartOptions = computed<object>(() => {
|
||||
if (props.data) {
|
||||
for (let i = 0; i < props.data.length; i++) {
|
||||
const item = props.data[i];
|
||||
const monthShortName = getCalendarShortMonthFromUnixTime(item.monthStartTime);
|
||||
const monthShortName = formatUnixTimeToGregorianLikeShortMonth(item.monthStartTime);
|
||||
|
||||
monthNames.push(monthShortName);
|
||||
incomeAmounts.push(item.incomeAmount);
|
||||
|
||||
@@ -136,9 +136,9 @@ const {
|
||||
tt,
|
||||
getCurrentLanguageTextDirection,
|
||||
getWeekdayShortName,
|
||||
getCalendarLongYearMonthFromUnixTime,
|
||||
getCalendarDisplayDayOfMonthFromUnixTime,
|
||||
formatUnixTimeToShortTime,
|
||||
getCalendarDayOfMonthFromUnixTime,
|
||||
formatUnixTimeToGregorianLikeLongYearMonth,
|
||||
formatAmountToLocalizedNumeralsWithCurrency
|
||||
} = useI18n();
|
||||
|
||||
@@ -149,8 +149,8 @@ const fontSize = ref<number>(settingsStore.appSettings.fontSize);
|
||||
|
||||
const textDirection = computed<string>(() => getCurrentLanguageTextDirection());
|
||||
const fontSizePreviewClassName = computed<string>(() => getFontSizePreviewClassName(fontSize.value));
|
||||
const currentLongYearMonth = computed<string>(() => getCalendarLongYearMonthFromUnixTime(currentUnixTime.value));
|
||||
const currentDayOfMonth = computed<string>(() => getCalendarDayOfMonthFromUnixTime(currentUnixTime.value));
|
||||
const currentLongYearMonth = computed<string>(() => formatUnixTimeToGregorianLikeLongYearMonth(currentUnixTime.value));
|
||||
const currentDayOfMonth = computed<string>(() => getCalendarDisplayDayOfMonthFromUnixTime(currentUnixTime.value));
|
||||
const currentDayOfWeek = computed<string>(() => getWeekdayShortName(parseDateTimeFromUnixTime(currentUnixTime.value).getWeekDay()));
|
||||
const currentShortTime = computed<string>(() => formatUnixTimeToShortTime(currentUnixTime.value));
|
||||
|
||||
|
||||
@@ -536,7 +536,7 @@ const {
|
||||
getMultiWeekdayLongNames,
|
||||
formatUnixTimeToLongDate,
|
||||
formatUnixTimeToLongTime,
|
||||
formatGregorianCalendarYearDashMonthDashDayToLongDate
|
||||
formatGregorianTextualYearMonthDayToLongDate
|
||||
} = useI18n();
|
||||
const { showAlert, showConfirm, showToast, routeBackOnError } = useI18nUIComponents();
|
||||
|
||||
@@ -756,7 +756,7 @@ const transactionDisplayScheduledStartDate = computed<string>(() => {
|
||||
const template = transaction.value as TransactionTemplate;
|
||||
|
||||
if (template.scheduledStartDate) {
|
||||
return formatGregorianCalendarYearDashMonthDashDayToLongDate(template.scheduledStartDate);
|
||||
return formatGregorianTextualYearMonthDayToLongDate(template.scheduledStartDate);
|
||||
} else {
|
||||
return tt('No limit');
|
||||
}
|
||||
@@ -770,7 +770,7 @@ const transactionDisplayScheduledEndDate = computed<string>(() => {
|
||||
const template = transaction.value as TransactionTemplate;
|
||||
|
||||
if (template.scheduledEndDate) {
|
||||
return formatGregorianCalendarYearDashMonthDashDayToLongDate(template.scheduledEndDate);
|
||||
return formatGregorianTextualYearMonthDayToLongDate(template.scheduledEndDate);
|
||||
} else {
|
||||
return tt('No limit');
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@
|
||||
<template #media>
|
||||
<div class="display-flex flex-direction-column transaction-date" :style="getTransactionDateStyle(transaction, idx > 0 ? transactionMonthList.items[idx - 1] : null)">
|
||||
<span class="transaction-day full-line flex-direction-column">
|
||||
{{ getCalendarDayOfMonthFromUnixTime(transaction.time) }}
|
||||
{{ getCalendarDisplayDayOfMonthFromUnixTime(transaction.time) }}
|
||||
</span>
|
||||
<span class="transaction-day-of-week full-line flex-direction-column" v-if="transaction.displayDayOfWeek">
|
||||
{{ getWeekdayShortName(transaction.displayDayOfWeek) }}
|
||||
@@ -646,7 +646,7 @@ const {
|
||||
getCurrentLanguageTextDirection,
|
||||
getAllTransactionTagFilterTypes,
|
||||
getWeekdayShortName,
|
||||
getCalendarDayOfMonthFromUnixTime
|
||||
getCalendarDisplayDayOfMonthFromUnixTime
|
||||
} = useI18n();
|
||||
|
||||
const { showAlert, showToast, routeBackOnError } = useI18nUIComponents();
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
link="#" no-chevron
|
||||
class="list-item-with-header-and-title list-item-no-item-after"
|
||||
:header="tt('Fiscal Year Start Date')"
|
||||
:title="getCalendarLongMonthDayFromFiscalYearStart(newProfile.fiscalYearStart)"
|
||||
:title="formatFiscalYearStartToGregorianLikeLongMonth(newProfile.fiscalYearStart)"
|
||||
@click="showFiscalYearStartSheet = true"
|
||||
>
|
||||
<fiscal-year-start-selection-sheet
|
||||
@@ -587,7 +587,7 @@ const {
|
||||
getAllLanguageOptions,
|
||||
getAllCurrencies,
|
||||
getCurrencyName,
|
||||
getCalendarLongMonthDayFromFiscalYearStart
|
||||
formatFiscalYearStartToGregorianLikeLongMonth
|
||||
} = useI18n();
|
||||
|
||||
const { showAlert, showToast, routeBackOnError } = useI18nUIComponents();
|
||||
|
||||
Reference in New Issue
Block a user