use and display the Gregorian calendar when calculating months, quarters, years, and fiscal years

This commit is contained in:
MaysWind
2025-09-08 00:32:30 +08:00
parent 5591abdb3b
commit 642e51bc0c
14 changed files with 120 additions and 104 deletions
+9 -9
View File
@@ -20,9 +20,9 @@ import type {
export function useHomePageBase() {
const {
formatUnixTimeToLongDate,
formatUnixTimeToLongYear,
formatUnixTimeToLongMonth,
formatUnixTimeToLongMonthDay,
getCalendarLongYearFromUnixTime,
getCalendarLongMonthFromUnixTime,
getCalendarLongMonthDayFromUnixTime,
formatAmountToLocalizedNumeralsWithCurrency
} = useI18n();
@@ -60,16 +60,16 @@ export function useHomePageBase() {
displayTime: formatUnixTimeToLongDate(overviewStore.transactionDataRange.today.startTime),
},
thisWeek: {
startTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisWeek.startTime),
endTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisWeek.endTime)
startTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisWeek.startTime),
endTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisWeek.endTime)
},
thisMonth: {
displayTime: formatUnixTimeToLongMonth(overviewStore.transactionDataRange.thisMonth.startTime),
startTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisMonth.startTime),
endTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisMonth.endTime)
displayTime: getCalendarLongMonthFromUnixTime(overviewStore.transactionDataRange.thisMonth.startTime),
startTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisMonth.startTime),
endTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisMonth.endTime)
},
thisYear: {
displayTime: formatUnixTimeToLongYear(overviewStore.transactionDataRange.thisYear.startTime)
displayTime: getCalendarLongYearFromUnixTime(overviewStore.transactionDataRange.thisYear.startTime)
}
};
});
@@ -30,7 +30,7 @@ export function useStatisticsTransactionPageBase() {
getAllStatisticsSortingTypes,
getAllStatisticsDateAggregationTypes,
formatUnixTimeToLongDateTime,
formatUnixTimeToLongYearMonth,
getCalendarLongYearMonthFromUnixTime,
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 formatUnixTimeToLongYearMonth(getYearMonthFirstUnixTime(query.value.trendChartStartYearMonth));
return getCalendarLongYearMonthFromUnixTime(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 formatUnixTimeToLongYearMonth(getYearMonthLastUnixTime(query.value.trendChartEndYearMonth));
return getCalendarLongYearMonthFromUnixTime(getYearMonthLastUnixTime(query.value.trendChartEndYearMonth));
} else {
return '';
}
@@ -78,7 +78,7 @@ export function useTransactionListPageBase() {
getCurrentNumeralSystemType,
formatUnixTimeToLongDateTime,
formatUnixTimeToLongDate,
formatUnixTimeToLongYearMonth,
getCalendarLongYearMonthFromUnixTime,
formatUnixTimeToShortTime,
formatDateRange,
formatAmountToLocalizedNumeralsWithCurrency
@@ -287,7 +287,7 @@ export function useTransactionListPageBase() {
}
function getDisplayLongYearMonth(transactionMonthList: TransactionMonthList): string {
return formatUnixTimeToLongYearMonth(getYearMonthFirstUnixTime(transactionMonthList.yearDashMonth));
return getCalendarLongYearMonthFromUnixTime(getYearMonthFirstUnixTime(transactionMonthList.yearDashMonth));
}
function getDisplayTimezone(transaction: Transaction): string {
@@ -60,7 +60,12 @@ const emit = defineEmits<{
(e: 'click', event: MonthlyIncomeAndExpenseCardClickEvent): void;
}>();
const { tt, getCurrentLanguageTextDirection, formatUnixTimeToShortMonth, formatAmountToLocalizedNumeralsWithCurrency } = useI18n();
const {
tt,
getCurrentLanguageTextDirection,
getCalendarShortMonthFromUnixTime,
formatAmountToLocalizedNumeralsWithCurrency
} = useI18n();
const settingsStore = useSettingsStore();
const userStore = useUserStore();
@@ -96,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 = formatUnixTimeToShortMonth(item.monthStartTime);
const monthShortName = getCalendarShortMonthFromUnixTime(item.monthStartTime);
monthNames.push(monthShortName);
incomeAmounts.push(item.incomeAmount);
@@ -136,9 +136,9 @@ const {
tt,
getCurrentLanguageTextDirection,
getWeekdayShortName,
formatUnixTimeToLongYearMonth,
getCalendarLongYearMonthFromUnixTime,
formatUnixTimeToShortTime,
formatUnixTimeToDayOfMonth,
getCalendarDayOfMonthFromUnixTime,
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>(() => formatUnixTimeToLongYearMonth(currentUnixTime.value));
const currentDayOfMonth = computed<string>(() => formatUnixTimeToDayOfMonth(currentUnixTime.value));
const currentLongYearMonth = computed<string>(() => getCalendarLongYearMonthFromUnixTime(currentUnixTime.value));
const currentDayOfMonth = computed<string>(() => getCalendarDayOfMonthFromUnixTime(currentUnixTime.value));
const currentDayOfWeek = computed<string>(() => getWeekdayShortName(parseDateTimeFromUnixTime(currentUnixTime.value).getWeekDay()));
const currentShortTime = computed<string>(() => formatUnixTimeToShortTime(currentUnixTime.value));
+2 -2
View File
@@ -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">
{{ formatUnixTimeToDayOfMonth(transaction.time) }}
{{ getCalendarDayOfMonthFromUnixTime(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,
formatUnixTimeToDayOfMonth
getCalendarDayOfMonthFromUnixTime
} = useI18n();
const { showAlert, showToast, routeBackOnError } = useI18nUIComponents();
+2 -2
View File
@@ -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="formatFiscalYearStartToLongDay(newProfile.fiscalYearStart)"
:title="getCalendarLongMonthDayFromFiscalYearStart(newProfile.fiscalYearStart)"
@click="showFiscalYearStartSheet = true"
>
<fiscal-year-start-selection-sheet
@@ -587,7 +587,7 @@ const {
getAllLanguageOptions,
getAllCurrencies,
getCurrencyName,
formatFiscalYearStartToLongDay
getCalendarLongMonthDayFromFiscalYearStart
} = useI18n();
const { showAlert, showToast, routeBackOnError } = useI18nUIComponents();