From d4603a1892376622072552999283225bdb8cc109 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Tue, 9 Sep 2025 00:01:15 +0800 Subject: [PATCH] code refactor --- .../base/AccountBalanceTrendsChartBase.ts | 18 +- .../base/FiscalYearStartSelectionBase.ts | 4 +- .../base/MonthRangeSelectionBase.ts | 6 +- src/components/common/DateTimePicker.vue | 16 +- src/components/common/MonthPicker.vue | 10 +- src/components/common/TransactionCalendar.vue | 4 +- src/components/desktop/DateSelect.vue | 4 +- src/components/desktop/MonthlyTrendsChart.vue | 16 +- .../mobile/MonthlyTrendsBarChart.vue | 16 +- src/core/datetime.ts | 1 + src/lib/datetime.ts | 3 +- src/locales/helpers.ts | 192 ++++++++++-------- src/views/base/HomePageBase.ts | 18 +- .../ReconciliationStatementPageBase.ts | 4 +- .../StatisticsTransactionPageBase.ts | 6 +- .../transactions/TransactionListPageBase.ts | 4 +- .../cards/MonthlyIncomeAndExpenseCard.vue | 4 +- .../mobile/settings/TextSizeSettingsPage.vue | 8 +- src/views/mobile/transactions/EditPage.vue | 6 +- src/views/mobile/transactions/ListPage.vue | 4 +- src/views/mobile/users/UserProfilePage.vue | 4 +- 21 files changed, 189 insertions(+), 159 deletions(-) diff --git a/src/components/base/AccountBalanceTrendsChartBase.ts b/src/components/base/AccountBalanceTrendsChartBase.ts index 38175e68..19389702 100644 --- a/src/components/base/AccountBalanceTrendsChartBase.ts +++ b/src/components/base/AccountBalanceTrendsChartBase.ts @@ -52,11 +52,11 @@ export interface CommonAccountBalanceTrendsChartProps { export function useAccountBalanceTrendsChartBase(props: CommonAccountBalanceTrendsChartProps) { const { - getCalendarShortYearFromUnixTime, - getCalendarShortYearMonthFromUnixTime, - getCalendarYearQuarterFromUnixTime, - getCalendarFiscalYearFromUnixTime, - formatUnixTimeToShortDate + formatUnixTimeToShortDate, + formatUnixTimeToGregorianLikeShortYear, + formatUnixTimeToGregorianLikeShortYearMonth, + formatUnixTimeToGregorianLikeYearQuarter, + formatUnixTimeToGregorianLikeFiscalYear } = useI18n(); const dataDateRange = computed(() => { @@ -156,13 +156,13 @@ export function useAccountBalanceTrendsChartBase(props: CommonAccountBalanceTren let displayDate = ''; if (props.dateAggregationType === ChartDateAggregationType.Year.type) { - displayDate = getCalendarShortYearFromUnixTime(dateRange.minUnixTime); + displayDate = formatUnixTimeToGregorianLikeShortYear(dateRange.minUnixTime); } else if (props.dateAggregationType === ChartDateAggregationType.FiscalYear.type) { - displayDate = getCalendarFiscalYearFromUnixTime(dateRange.minUnixTime); + displayDate = formatUnixTimeToGregorianLikeFiscalYear(dateRange.minUnixTime); } else if (props.dateAggregationType === ChartDateAggregationType.Quarter.type) { - displayDate = getCalendarYearQuarterFromUnixTime(dateRange.minUnixTime); + displayDate = formatUnixTimeToGregorianLikeYearQuarter(dateRange.minUnixTime); } else if (props.dateAggregationType === ChartDateAggregationType.Month.type) { - displayDate = getCalendarShortYearMonthFromUnixTime(dateRange.minUnixTime); + displayDate = formatUnixTimeToGregorianLikeShortYearMonth(dateRange.minUnixTime); } else { displayDate = formatUnixTimeToShortDate(dateRange.minUnixTime); } diff --git a/src/components/base/FiscalYearStartSelectionBase.ts b/src/components/base/FiscalYearStartSelectionBase.ts index 2f58edfc..4feaa272 100644 --- a/src/components/base/FiscalYearStartSelectionBase.ts +++ b/src/components/base/FiscalYearStartSelectionBase.ts @@ -37,7 +37,7 @@ function getFiscalYearStartFromProps(props: CommonFiscalYearStartSelectionProps) } export function useFiscalYearStartSelectionBase(props: CommonFiscalYearStartSelectionProps) { - const { getCalendarLongMonthDayFromGregorianCalendarTextualMonthDay } = useI18n(); + const { formatGregorianTextualMonthDayToGregorianLikeLongMonthDay } = useI18n(); const disabledDates = (date: Date) => { // Disable February 29 (leap day) @@ -71,7 +71,7 @@ export function useFiscalYearStartSelectionBase(props: CommonFiscalYearStartSele fiscalYearStart = FiscalYearStart.Default; } - return getCalendarLongMonthDayFromGregorianCalendarTextualMonthDay(fiscalYearStart.toMonthDashDayString()); + return formatGregorianTextualMonthDayToGregorianLikeLongMonthDay(fiscalYearStart.toMonthDashDayString()); }); const allowedMinDate = computed(() => getLocalDatetimeFromUnixTime(getThisYearFirstUnixTime())); diff --git a/src/components/base/MonthRangeSelectionBase.ts b/src/components/base/MonthRangeSelectionBase.ts index a882e4d8..7b1e5e74 100644 --- a/src/components/base/MonthRangeSelectionBase.ts +++ b/src/components/base/MonthRangeSelectionBase.ts @@ -49,7 +49,7 @@ function getMonthRangeFromProps(props: CommonMonthRangeSelectionProps): { minDat } export function useMonthRangeSelectionBase(props: CommonMonthRangeSelectionProps) { - const { getCalendarLongYearMonthFromUnixTime } = useI18n(); + const { formatUnixTimeToGregorianLikeLongYearMonth } = useI18n(); const { minDate, maxDate } = getMonthRangeFromProps(props); const dateRange = ref([ @@ -57,8 +57,8 @@ export function useMonthRangeSelectionBase(props: CommonMonthRangeSelectionProps maxDate ]); - const beginDateTime = computed(() => getCalendarLongYearMonthFromUnixTime(getYearMonthFirstUnixTime(dateRange.value[0]))); - const endDateTime = computed(() => getCalendarLongYearMonthFromUnixTime(getYearMonthLastUnixTime(dateRange.value[1]))); + const beginDateTime = computed(() => formatUnixTimeToGregorianLikeLongYearMonth(getYearMonthFirstUnixTime(dateRange.value[0]))); + const endDateTime = computed(() => formatUnixTimeToGregorianLikeLongYearMonth(getYearMonthLastUnixTime(dateRange.value[1]))); function getFinalMonthRange(): { minYearMonth: TextualYearMonth | '', maxYearMonth: TextualYearMonth | '' } | null { if (!dateRange.value[0] || !dateRange.value[1]) { diff --git a/src/components/common/DateTimePicker.vue b/src/components/common/DateTimePicker.vue index 3b269d56..82bb2465 100644 --- a/src/components/common/DateTimePicker.vue +++ b/src/components/common/DateTimePicker.vue @@ -88,9 +88,9 @@ const { getCurrentCalendarDisplayType, isLongDateMonthAfterYear, isLongTime24HourFormat, - getCalendarShortYearFromUnixTime, - getCalendarShortMonthFromUnixTime, - getCalendarDayOfMonthFromUnixTime, + getCalendarDisplayShortYearFromUnixTime, + getCalendarDisplayShortMonthFromUnixTime, + getCalendarDisplayDayOfMonthFromUnixTime, getCalendarAlternateDate } = useI18n(); @@ -130,21 +130,21 @@ function switchView(viewType: MenuView): void { } function getDisplayYear(year: number): string { - return getCalendarShortYearFromUnixTime(getYearMonthDayDateTime(year, 1, 1).getUnixTime()); + return getCalendarDisplayShortYearFromUnixTime(getYearMonthDayDateTime(year, 1, 1).getUnixTime()); } function getDisplayMonth(month: number): string { if (isArray(dateTime.value)) { - return getCalendarShortMonthFromUnixTime(getYearMonthDayDateTime(dateTime.value[0].getFullYear(), month + 1, 1).getUnixTime()); + return getCalendarDisplayShortMonthFromUnixTime(getYearMonthDayDateTime(dateTime.value[0].getFullYear(), month + 1, 1).getUnixTime()); } else if (dateTime.value) { - return getCalendarShortMonthFromUnixTime(getYearMonthDayDateTime(dateTime.value.getFullYear(), month + 1, 1).getUnixTime()); + return getCalendarDisplayShortMonthFromUnixTime(getYearMonthDayDateTime(dateTime.value.getFullYear(), month + 1, 1).getUnixTime()); } else { - return getCalendarShortMonthFromUnixTime(getYearMonthDayDateTime(new Date().getFullYear(), month + 1, 1).getUnixTime()); + return getCalendarDisplayShortMonthFromUnixTime(getYearMonthDayDateTime(new Date().getFullYear(), month + 1, 1).getUnixTime()); } } function getDisplayDay(date: Date): string { - return getCalendarDayOfMonthFromUnixTime(getYearMonthDayDateTime(date.getFullYear(), date.getMonth() + 1, date.getDate()).getUnixTime()); + return getCalendarDisplayDayOfMonthFromUnixTime(getYearMonthDayDateTime(date.getFullYear(), date.getMonth() + 1, date.getDate()).getUnixTime()); } defineExpose({ diff --git a/src/components/common/MonthPicker.vue b/src/components/common/MonthPicker.vue index ed75b9b9..e8d0875c 100644 --- a/src/components/common/MonthPicker.vue +++ b/src/components/common/MonthPicker.vue @@ -55,8 +55,8 @@ const emit = defineEmits<{ const { isLongDateMonthAfterYear, - getCalendarShortYearFromUnixTime, - getCalendarShortMonthFromUnixTime + getCalendarDisplayShortYearFromUnixTime, + getCalendarDisplayShortMonthFromUnixTime } = useI18n(); const yearRange = getAllowedYearRange(); @@ -97,14 +97,14 @@ function getYear0BasedMonthFromMonthSelectionValue(value: MonthSelectionValue): } function getDisplayYear(year: number): string { - return getCalendarShortYearFromUnixTime(getYearMonthDayDateTime(year, 1, 1).getUnixTime()); + return getCalendarDisplayShortYearFromUnixTime(getYearMonthDayDateTime(year, 1, 1).getUnixTime()); } function getDisplayMonth(month: number): string { if (isArray(dateTime.value)) { - return getCalendarShortMonthFromUnixTime(getYearMonthDayDateTime(dateTime.value[0].year, month + 1, 1).getUnixTime()); + return getCalendarDisplayShortMonthFromUnixTime(getYearMonthDayDateTime(dateTime.value[0].year, month + 1, 1).getUnixTime()); } else { - return getCalendarShortMonthFromUnixTime(getYearMonthDayDateTime(dateTime.value.year, month + 1, 1).getUnixTime()); + return getCalendarDisplayShortMonthFromUnixTime(getYearMonthDayDateTime(dateTime.value.year, month + 1, 1).getUnixTime()); } } diff --git a/src/components/common/TransactionCalendar.vue b/src/components/common/TransactionCalendar.vue index e66ea7c1..9fe3715c 100644 --- a/src/components/common/TransactionCalendar.vue +++ b/src/components/common/TransactionCalendar.vue @@ -69,7 +69,7 @@ const emit = defineEmits<{ const { getAllLongWeekdayNames, getAllShortWeekdayNames, - getCalendarDayOfMonthFromUnixTime, + getCalendarDisplayDayOfMonthFromUnixTime, getCalendarAlternateDates, formatAmountToLocalizedNumeralsWithCurrency } = useI18n(); @@ -117,7 +117,7 @@ function getDisplayMonthTotalAmount(amount: number, currency: string | false, sy } function getDisplayDay(date: Date): string { - return getCalendarDayOfMonthFromUnixTime(getYearMonthDayDateTime(date.getFullYear(), date.getMonth() + 1, date.getDate()).getUnixTime()); + return getCalendarDisplayDayOfMonthFromUnixTime(getYearMonthDayDateTime(date.getFullYear(), date.getMonth() + 1, date.getDate()).getUnixTime()); } diff --git a/src/components/desktop/DateSelect.vue b/src/components/desktop/DateSelect.vue index a7f2edaa..8cd6cdb9 100644 --- a/src/components/desktop/DateSelect.vue +++ b/src/components/desktop/DateSelect.vue @@ -51,7 +51,7 @@ const emit = defineEmits<{ }>(); const theme = useTheme(); -const { tt, formatGregorianCalendarYearDashMonthDashDayToLongDate } = useI18n(); +const { tt, formatGregorianTextualYearMonthDayToLongDate } = useI18n(); const dateTime = computed({ get: () => props.modelValue ? getLocalDateFromYearDashMonthDashDay(props.modelValue) : null, @@ -62,7 +62,7 @@ const isDarkMode = computed(() => theme.global.name.value === ThemeType const displayTime = computed({ get: () => { if (props.modelValue) { - return formatGregorianCalendarYearDashMonthDashDayToLongDate(props.modelValue); + return formatGregorianTextualYearMonthDayToLongDate(props.modelValue); } else if (props.noDataText) { return props.noDataText; } else { diff --git a/src/components/desktop/MonthlyTrendsChart.vue b/src/components/desktop/MonthlyTrendsChart.vue index a5cbc05a..1726ca2c 100644 --- a/src/components/desktop/MonthlyTrendsChart.vue +++ b/src/components/desktop/MonthlyTrendsChart.vue @@ -80,10 +80,10 @@ const theme = useTheme(); const { tt, getCurrentLanguageTextDirection, - getCalendarShortYearFromUnixTime, - getCalendarShortYearMonthFromUnixTime, - getCalendarYearQuarterFromYearQuarter, - getCalendarFiscalYearFromUnixTime, + formatUnixTimeToGregorianLikeShortYear, + formatUnixTimeToGregorianLikeShortYearMonth, + formatYearQuarterToGregorianLikeYearQuarter, + formatUnixTimeToGregorianLikeFiscalYear, formatAmountToWesternArabicNumeralsWithoutDigitGrouping, formatAmountToLocalizedNumeralsWithCurrency } = useI18n(); @@ -139,13 +139,13 @@ const allDisplayDateRanges = computed(() => { const dateRange = allDateRanges.value[i]; if (props.dateAggregationType === ChartDateAggregationType.Year.type) { - allDisplayDateRanges.push(getCalendarShortYearFromUnixTime(dateRange.minUnixTime)); + allDisplayDateRanges.push(formatUnixTimeToGregorianLikeShortYear(dateRange.minUnixTime)); } else if (props.dateAggregationType === ChartDateAggregationType.FiscalYear.type && 'year' in dateRange) { - allDisplayDateRanges.push(getCalendarFiscalYearFromUnixTime(dateRange.minUnixTime)); + allDisplayDateRanges.push(formatUnixTimeToGregorianLikeFiscalYear(dateRange.minUnixTime)); } else if (props.dateAggregationType === ChartDateAggregationType.Quarter.type && 'quarter' in dateRange) { - allDisplayDateRanges.push(getCalendarYearQuarterFromYearQuarter(dateRange.year, dateRange.quarter)); + allDisplayDateRanges.push(formatYearQuarterToGregorianLikeYearQuarter(dateRange.year, dateRange.quarter)); } else { // if (props.dateAggregationType === ChartDateAggregationType.Month.type) { - allDisplayDateRanges.push(getCalendarShortYearMonthFromUnixTime(dateRange.minUnixTime)); + allDisplayDateRanges.push(formatUnixTimeToGregorianLikeShortYearMonth(dateRange.minUnixTime)); } } diff --git a/src/components/mobile/MonthlyTrendsBarChart.vue b/src/components/mobile/MonthlyTrendsBarChart.vue index 6be94885..8ead7f3b 100644 --- a/src/components/mobile/MonthlyTrendsBarChart.vue +++ b/src/components/mobile/MonthlyTrendsBarChart.vue @@ -156,10 +156,10 @@ const emit = defineEmits<{ const { tt, - getCalendarShortYearFromUnixTime, - getCalendarShortYearMonthFromUnixTime, - getCalendarYearQuarterFromYearQuarter, - getCalendarFiscalYearFromUnixTime, + formatUnixTimeToGregorianLikeShortYear, + formatUnixTimeToGregorianLikeShortYearMonth, + formatYearQuarterToGregorianLikeYearQuarter, + formatUnixTimeToGregorianLikeFiscalYear, formatAmountToLocalizedNumeralsWithCurrency } = useI18n(); @@ -250,13 +250,13 @@ const allDisplayDataItems = computed(() => { let displayDateRange = ''; if (props.dateAggregationType === ChartDateAggregationType.Year.type) { - displayDateRange = getCalendarShortYearFromUnixTime(dateRange.minUnixTime); + displayDateRange = formatUnixTimeToGregorianLikeShortYear(dateRange.minUnixTime); } else if (props.dateAggregationType === ChartDateAggregationType.FiscalYear.type) { - displayDateRange = getCalendarFiscalYearFromUnixTime(dateRange.minUnixTime); + displayDateRange = formatUnixTimeToGregorianLikeFiscalYear(dateRange.minUnixTime); } else if (props.dateAggregationType === ChartDateAggregationType.Quarter.type && 'quarter' in dateRange) { - displayDateRange = getCalendarYearQuarterFromYearQuarter(dateRange.year, dateRange.quarter); + displayDateRange = formatYearQuarterToGregorianLikeYearQuarter(dateRange.year, dateRange.quarter); } else { // if (props.dateAggregationType === ChartDateAggregationType.Month.type) { - displayDateRange = getCalendarShortYearMonthFromUnixTime(dateRange.minUnixTime); + displayDateRange = formatUnixTimeToGregorianLikeShortYearMonth(dateRange.minUnixTime); } const dataItems = allDateRangeItemsMap[dateRangeKey] || []; diff --git a/src/core/datetime.ts b/src/core/datetime.ts index e4c482a9..2295bd75 100644 --- a/src/core/datetime.ts +++ b/src/core/datetime.ts @@ -51,6 +51,7 @@ export interface DateTimeLocaleData { } export type TextualYearMonth = `${number}-${number}`; +export type TextualMonthDay = `${number}-${number}`; export type TextualYearMonthDay = `${number}-${number}-${number}`; export interface YearQuarter { diff --git a/src/lib/datetime.ts b/src/lib/datetime.ts index aea86c0a..922c3c31 100644 --- a/src/lib/datetime.ts +++ b/src/lib/datetime.ts @@ -11,6 +11,7 @@ import { type DateTime, type DateTimeFormatOptions, type TextualYearMonth, + type TextualMonthDay, type TextualYearMonthDay, type YearUnixTime, type YearQuarter, @@ -565,7 +566,7 @@ export function formatGregorianCalendarYearDashMonthDashDay(date: TextualYearMon return MomentDateTime.of(moment(date, 'YYYY-MM-DD')).format(format, options); } -export function formatGregorianCalendarMonthDashDay(monthDay: TextualYearMonth, format: string, options: DateTimeFormatOptions): string { +export function formatGregorianCalendarMonthDashDay(monthDay: TextualMonthDay, format: string, options: DateTimeFormatOptions): string { return MomentDateTime.of(moment(monthDay, 'MM-DD')).format(format, options); } diff --git a/src/locales/helpers.ts b/src/locales/helpers.ts index edf6209b..a6b7d6e3 100644 --- a/src/locales/helpers.ts +++ b/src/locales/helpers.ts @@ -37,7 +37,7 @@ import { type DateTime, type DateTimeFormatOptions, type DateTimeLocaleData, - type TextualYearMonth, + type TextualMonthDay, type TextualYearMonthDay, type Year1BasedMonth, type YearMonthDay, @@ -778,15 +778,38 @@ export function useI18n() { return ''; } - function formatTimeRangeToFiscalYearFormat(format: FiscalYearFormat, timeRange: FiscalYearUnixTime | UnixTimeRange, numeralSystem?: NumeralSystem, calendarType?: CalendarType): string { + function isGregorianLikeCalendarType(calendarType: CalendarType): boolean { + return calendarType === CalendarType.Gregorian || calendarType === CalendarType.Buddhist; + } + + function getGregorianLikeCalendarType(): CalendarType { + const currentDateDisplayType = getCurrentDateDisplayType(); + + if (isGregorianLikeCalendarType(currentDateDisplayType.calendarType)) { + return currentDateDisplayType.calendarType; + } + + return CalendarType.Gregorian; + } + + function formatYearQuarter(year: string, quarter: number): string { + if (1 <= quarter && quarter <= 4) { + return t('format.yearQuarter.q' + quarter, { + year: year, + quarter: quarter + }); + } else { + return ''; + } + } + + function formatTimeRangeToGregorianLikeFiscalYearFormat(format: FiscalYearFormat, timeRange: FiscalYearUnixTime | UnixTimeRange, numeralSystem?: NumeralSystem, calendarType?: CalendarType): string { if (!format) { format = FiscalYearFormat.Default; } - const currentCalendarDisplayType = getCurrentCalendarDisplayType(); - - if (!isDefined(calendarType)) { - calendarType = currentCalendarDisplayType.primaryCalendarType; + if (!isDefined(calendarType) || !isGregorianLikeCalendarType(calendarType)) { + calendarType = getGregorianLikeCalendarType(); } const dateTimeFormatOptions = getDateTimeFormatOptions({ @@ -1241,7 +1264,7 @@ export function useI18n() { ret.push({ type: LANGUAGE_DEFAULT_FISCAL_YEAR_FORMAT_VALUE, - displayName: `${t('Language Default')} (${formatTimeRangeToFiscalYearFormat(defaultFiscalYearFormat, currentFiscalYearRange, numeralSystem, calendarType)})` + displayName: `${t('Language Default')} (${formatTimeRangeToGregorianLikeFiscalYearFormat(defaultFiscalYearFormat, currentFiscalYearRange, numeralSystem, calendarType)})` }); const allFiscalYearFormats = FiscalYearFormat.values(); @@ -1251,7 +1274,7 @@ export function useI18n() { ret.push({ type: fiscalYearFormat.type, - displayName: formatTimeRangeToFiscalYearFormat(fiscalYearFormat, currentFiscalYearRange, numeralSystem, calendarType), + displayName: formatTimeRangeToGregorianLikeFiscalYearFormat(fiscalYearFormat, currentFiscalYearRange, numeralSystem, calendarType), }); } @@ -1807,29 +1830,58 @@ export function useI18n() { return getLocalizedLongTimeFormat().indexOf('ss') >= 0; } - function getCalendarLongMonthDayFromGregorianCalendarTextualMonthDay(monthDay: TextualYearMonth): string { - const currentCalendarDisplayType = getCurrentCalendarDisplayType(); - return formatGregorianCalendarMonthDashDay(monthDay, getLocalizedLongMonthDayFormat(), getDateTimeFormatOptions({ calendarType: currentCalendarDisplayType.primaryCalendarType })); + function formatGregorianTextualMonthDayToGregorianLikeLongMonthDay(monthDay: TextualMonthDay): string { + const gregorianLikeCalendarType = getGregorianLikeCalendarType(); + return formatGregorianCalendarMonthDashDay(monthDay, getLocalizedLongMonthDayFormat(), getDateTimeFormatOptions({ calendarType: gregorianLikeCalendarType })); } - function getCalendarYearQuarterFromUnixTime(unixTime: number): string { - const currentCalendarDisplayType = getCurrentCalendarDisplayType(); - const dateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: currentCalendarDisplayType.primaryCalendarType }); + function formatUnixTimeToGregorianLikeYearQuarter(unixTime: number): string { + const gregorianLikeCalendarType = getGregorianLikeCalendarType(); + const dateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: gregorianLikeCalendarType }); const date = parseDateTimeFromUnixTime(unixTime); const year = date.getLocalizedCalendarYear(dateTimeFormatOptions); const quarter = date.getLocalizedCalendarQuarter(dateTimeFormatOptions); - return getCalendarYearQuarterFromYearQuarter(year, quarter); + return formatYearQuarter(year, quarter); } - function getCalendarYearQuarterFromYearQuarter(year: number | string, quarter: number): string { - if (1 <= quarter && quarter <= 4) { - return t('format.yearQuarter.q' + quarter, { - year: year, - quarter: quarter - }); - } else { - return ''; + function formatYearQuarterToGregorianLikeYearQuarter(year: number, quarter: number): string { + const gregorianLikeCalendarType = getGregorianLikeCalendarType(); + const dateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: gregorianLikeCalendarType }); + const date = getYearMonthDayDateTime(year, 1, 1); + const textualYear = date.getLocalizedCalendarYear(dateTimeFormatOptions); + return formatYearQuarter(textualYear, quarter); + } + + function formatUnixTimeToGregorianLikeFiscalYear(unixTime: number): string { + let fiscalYearFormat = FiscalYearFormat.valueOf(getCurrentFiscalYearFormatType()); + + if (!fiscalYearFormat) { + fiscalYearFormat = FiscalYearFormat.Default; } + + const timeRange = getFiscalYearTimeRangeFromUnixTime(unixTime, userStore.currentUserFiscalYearStart); + return formatTimeRangeToGregorianLikeFiscalYearFormat(fiscalYearFormat, timeRange); + } + + function formatGregorianYearToGregorianLikeFiscalYear(year: number) { + let fiscalYearFormat = FiscalYearFormat.valueOf(getCurrentFiscalYearFormatType()); + + if (!fiscalYearFormat) { + fiscalYearFormat = FiscalYearFormat.Default; + } + + const timeRange = getFiscalYearTimeRangeFromYear(year, userStore.currentUserFiscalYearStart); + return formatTimeRangeToGregorianLikeFiscalYearFormat(fiscalYearFormat, timeRange); + } + + function formatFiscalYearStartToGregorianLikeLongMonth(fiscalYearStartValue: number) { + let fiscalYearStart = FiscalYearStart.valueOf(fiscalYearStartValue); + + if (!fiscalYearStart) { + fiscalYearStart = FiscalYearStart.Default; + } + + return formatGregorianTextualMonthDayToGregorianLikeLongMonthDay(fiscalYearStart.toMonthDashDayString()); } function formatDateRange(dateType: number, startTime: number, endTime: number): string { @@ -1838,8 +1890,9 @@ export function useI18n() { } const allDateRanges = DateRange.values(); - const currentCalendarDisplayType = getCurrentCalendarDisplayType(); - const dateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: currentCalendarDisplayType.primaryCalendarType }); + const gregorianLikeCalendarType = getGregorianLikeCalendarType(); + const dateTimeFormatOptions = getDateTimeFormatOptions(); + const gregorianLikeDateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: gregorianLikeCalendarType }); for (let i = 0; i < allDateRanges.length; i++) { const dateRange = allDateRanges[i]; @@ -1851,22 +1904,22 @@ export function useI18n() { if (isDateRangeMatchFullYears(startTime, endTime)) { const format = getLocalizedShortYearFormat(); - const displayStartTime = formatUnixTime(startTime, format, dateTimeFormatOptions); - const displayEndTime = formatUnixTime(endTime, format, dateTimeFormatOptions); + const displayStartTime = formatUnixTime(startTime, format, gregorianLikeDateTimeFormatOptions); + const displayEndTime = formatUnixTime(endTime, format, gregorianLikeDateTimeFormatOptions); return displayStartTime !== displayEndTime ? `${displayStartTime} ~ ${displayEndTime}` : displayStartTime; } if (isDateRangeMatchFullMonths(startTime, endTime)) { const format = getLocalizedShortYearMonthFormat(); - const displayStartTime = formatUnixTime(startTime, format, dateTimeFormatOptions); - const displayEndTime = formatUnixTime(endTime, format, dateTimeFormatOptions); + const displayStartTime = formatUnixTime(startTime, format, gregorianLikeDateTimeFormatOptions); + const displayEndTime = formatUnixTime(endTime, format, gregorianLikeDateTimeFormatOptions); return displayStartTime !== displayEndTime ? `${displayStartTime} ~ ${displayEndTime}` : displayStartTime; } - const startTimeYear = parseDateTimeFromUnixTime(startTime).getLocalizedCalendarYear(dateTimeFormatOptions); - const endTimeYear = parseDateTimeFromUnixTime(endTime).getLocalizedCalendarYear(dateTimeFormatOptions); + const startTimeYear = parseDateTimeFromUnixTime(startTime).getLocalizedCalendarYear(gregorianLikeDateTimeFormatOptions); + const endTimeYear = parseDateTimeFromUnixTime(endTime).getLocalizedCalendarYear(gregorianLikeDateTimeFormatOptions); const format = getLocalizedShortDateFormat(); const displayStartTime = formatUnixTime(startTime, format, dateTimeFormatOptions); @@ -1875,45 +1928,13 @@ export function useI18n() { if (displayStartTime === displayEndTime) { return displayStartTime; } else if (startTimeYear === endTimeYear) { - const displayShortEndTime = formatUnixTime(endTime, getLocalizedShortMonthDayFormat(), dateTimeFormatOptions); + const displayShortEndTime = formatUnixTime(endTime, getLocalizedShortMonthDayFormat(), gregorianLikeDateTimeFormatOptions); return `${displayStartTime} ~ ${displayShortEndTime}`; } return `${displayStartTime} ~ ${displayEndTime}`; } - function getCalendarFiscalYearFromUnixTime(unixTime: number): string { - let fiscalYearFormat = FiscalYearFormat.valueOf(getCurrentFiscalYearFormatType()); - - if (!fiscalYearFormat) { - fiscalYearFormat = FiscalYearFormat.Default; - } - - const timeRange = getFiscalYearTimeRangeFromUnixTime(unixTime, userStore.currentUserFiscalYearStart); - return formatTimeRangeToFiscalYearFormat(fiscalYearFormat, timeRange); - } - - function getCalendarFiscalYearGregorianCalendarYear(year: number) { - let fiscalYearFormat = FiscalYearFormat.valueOf(getCurrentFiscalYearFormatType()); - - if (!fiscalYearFormat) { - fiscalYearFormat = FiscalYearFormat.Default; - } - - const timeRange = getFiscalYearTimeRangeFromYear(year, userStore.currentUserFiscalYearStart); - return formatTimeRangeToFiscalYearFormat(fiscalYearFormat, timeRange); - } - - function getCalendarLongMonthDayFromFiscalYearStart(fiscalYearStartValue: number) { - let fiscalYearStart = FiscalYearStart.valueOf(fiscalYearStartValue); - - if (!fiscalYearStart) { - fiscalYearStart = FiscalYearStart.Default; - } - - return getCalendarLongMonthDayFromGregorianCalendarTextualMonthDay(fiscalYearStart.toMonthDashDayString()); - } - function getTimezoneDifferenceDisplayText(utcOffset: number): string { const numeralSystem = getCurrentNumeralSystemType(); const defaultTimezoneOffset = getTimezoneOffsetMinutes(); @@ -2400,34 +2421,41 @@ export function useI18n() { isLongTimeHourTwoDigits, isLongTimeMinuteTwoDigits, isLongTimeSecondTwoDigits, - // format functions - getCalendarLongYearFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongYearFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), - getCalendarShortYearFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortYearFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), - getCalendarLongMonthFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, 'MMMM', getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), - getCalendarShortMonthFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, 'MMM', getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), - getCalendarDayOfMonthFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortDayFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), - getCalendarLongYearMonthFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongYearMonthFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), - getCalendarShortYearMonthFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortYearMonthFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), - getCalendarLongMonthDayFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongMonthDayFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), - getCalendarShortMonthDayFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortMonthDayFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), - getCalendarYearQuarterFromUnixTime, - getCalendarYearQuarterFromYearQuarter, - getCalendarFiscalYearFromUnixTime, - getCalendarFiscalYearGregorianCalendarYear, - getCalendarLongMonthDayFromGregorianCalendarTextualMonthDay, - getCalendarLongMonthDayFromFiscalYearStart, - formatUnixTimeToDefaultDateTimeWithoutLocaleOptions: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, KnownDateTimeFormat.DefaultDateTime.format, getDateTimeFormatOptions({ numeralSystem: NumeralSystem.WesternArabicNumerals, calendarType: CalendarType.Gregorian }), utcOffset, currentUtcOffset), + // format date time (by calendar display type) functions + getCalendarDisplayShortYearFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortYearFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), + getCalendarDisplayShortMonthFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, 'MMM', getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), + getCalendarDisplayDayOfMonthFromUnixTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortDayFormat(), getDateTimeFormatOptions({ calendarType: getCurrentCalendarDisplayType().primaryCalendarType }), utcOffset, currentUtcOffset), + // format date time (by date display type) functions formatUnixTimeToLongDateTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongDateFormat() + ' ' + getLocalizedLongTimeFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset), formatUnixTimeToShortDateTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortDateFormat() + ' ' + getLocalizedShortTimeFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset), formatUnixTimeToLongDate: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongDateFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset), formatUnixTimeToShortDate: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortDateFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset), + formatUnixTimeToLongMonthDay: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongMonthDayFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset), + formatUnixTimeToShortMonthDay: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortMonthDayFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset), formatUnixTimeToLongTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongTimeFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset), formatUnixTimeToShortTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortTimeFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset), - formatGregorianCalendarYearDashMonthDashDayToLongDate: (date: TextualYearMonthDay) => formatGregorianCalendarYearDashMonthDashDay(date, getLocalizedLongDateFormat(), getDateTimeFormatOptions()), + formatGregorianTextualYearMonthDayToLongDate: (date: TextualYearMonthDay) => formatGregorianCalendarYearDashMonthDashDay(date, getLocalizedLongDateFormat(), getDateTimeFormatOptions()), + // format date time (Gregorian calendar and Gregorian-like calendar) functions + formatUnixTimeToGregorianLikeLongYear: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongYearFormat(), getDateTimeFormatOptions({ calendarType: getGregorianLikeCalendarType() }), utcOffset, currentUtcOffset), + formatUnixTimeToGregorianLikeShortYear: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortYearFormat(), getDateTimeFormatOptions({ calendarType: getGregorianLikeCalendarType() }), utcOffset, currentUtcOffset), + formatUnixTimeToGregorianLikeLongYearMonth: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongYearMonthFormat(), getDateTimeFormatOptions({ calendarType: getGregorianLikeCalendarType() }), utcOffset, currentUtcOffset), + formatUnixTimeToGregorianLikeShortYearMonth: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortYearMonthFormat(), getDateTimeFormatOptions({ calendarType: getGregorianLikeCalendarType() }), utcOffset, currentUtcOffset), + formatUnixTimeToGregorianLikeLongMonth: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, 'MMMM', getDateTimeFormatOptions({ calendarType: getGregorianLikeCalendarType() }), utcOffset, currentUtcOffset), + formatUnixTimeToGregorianLikeShortMonth: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, 'MMM', getDateTimeFormatOptions({ calendarType: getGregorianLikeCalendarType() }), utcOffset, currentUtcOffset), + formatGregorianTextualMonthDayToGregorianLikeLongMonthDay, + formatUnixTimeToGregorianLikeYearQuarter, + formatYearQuarterToGregorianLikeYearQuarter, + formatUnixTimeToGregorianLikeFiscalYear, + formatGregorianYearToGregorianLikeFiscalYear, + formatFiscalYearStartToGregorianLikeLongMonth, + // format date time (Gregorian calendar) functions + formatUnixTimeToGregorianDefaultDateTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, KnownDateTimeFormat.DefaultDateTime.format, getDateTimeFormatOptions({ numeralSystem: NumeralSystem.WesternArabicNumerals, calendarType: CalendarType.Gregorian }), utcOffset, currentUtcOffset), + // other format date time functions formatDateRange, getTimezoneDifferenceDisplayText, getCalendarAlternateDates, getCalendarAlternateDate, + // format amount/number functions parseAmountFromLocalizedNumerals: (value: string) => getParsedAmountNumber(value), parseAmountFromWesternArabicNumerals: (value: string) => getParsedAmountNumber(value, NumeralSystem.WesternArabicNumerals), formatAmountToLocalizedNumerals: (value: number, currencyCode?: string) => getFormattedAmount(value, undefined, undefined, currencyCode), diff --git a/src/views/base/HomePageBase.ts b/src/views/base/HomePageBase.ts index ec71dd42..a0eb660c 100644 --- a/src/views/base/HomePageBase.ts +++ b/src/views/base/HomePageBase.ts @@ -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) } }; }); diff --git a/src/views/base/accounts/ReconciliationStatementPageBase.ts b/src/views/base/accounts/ReconciliationStatementPageBase.ts index 6db64671..44435639 100644 --- a/src/views/base/accounts/ReconciliationStatementPageBase.ts +++ b/src/views/base/accounts/ReconciliationStatementPageBase.ts @@ -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, diff --git a/src/views/base/statistics/StatisticsTransactionPageBase.ts b/src/views/base/statistics/StatisticsTransactionPageBase.ts index 9ab74885..1a6423e9 100644 --- a/src/views/base/statistics/StatisticsTransactionPageBase.ts +++ b/src/views/base/statistics/StatisticsTransactionPageBase.ts @@ -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 ''; } diff --git a/src/views/base/transactions/TransactionListPageBase.ts b/src/views/base/transactions/TransactionListPageBase.ts index 1eb6c9f5..d3b88005 100644 --- a/src/views/base/transactions/TransactionListPageBase.ts +++ b/src/views/base/transactions/TransactionListPageBase.ts @@ -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 { diff --git a/src/views/desktop/overview/cards/MonthlyIncomeAndExpenseCard.vue b/src/views/desktop/overview/cards/MonthlyIncomeAndExpenseCard.vue index f0d09d46..affc8b40 100644 --- a/src/views/desktop/overview/cards/MonthlyIncomeAndExpenseCard.vue +++ b/src/views/desktop/overview/cards/MonthlyIncomeAndExpenseCard.vue @@ -63,7 +63,7 @@ const emit = defineEmits<{ const { tt, getCurrentLanguageTextDirection, - getCalendarShortMonthFromUnixTime, + formatUnixTimeToGregorianLikeShortMonth, formatAmountToLocalizedNumeralsWithCurrency } = useI18n(); @@ -101,7 +101,7 @@ const chartOptions = computed(() => { 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); diff --git a/src/views/mobile/settings/TextSizeSettingsPage.vue b/src/views/mobile/settings/TextSizeSettingsPage.vue index 22b652c8..b52409ff 100644 --- a/src/views/mobile/settings/TextSizeSettingsPage.vue +++ b/src/views/mobile/settings/TextSizeSettingsPage.vue @@ -136,9 +136,9 @@ const { tt, getCurrentLanguageTextDirection, getWeekdayShortName, - getCalendarLongYearMonthFromUnixTime, + getCalendarDisplayDayOfMonthFromUnixTime, formatUnixTimeToShortTime, - getCalendarDayOfMonthFromUnixTime, + formatUnixTimeToGregorianLikeLongYearMonth, formatAmountToLocalizedNumeralsWithCurrency } = useI18n(); @@ -149,8 +149,8 @@ const fontSize = ref(settingsStore.appSettings.fontSize); const textDirection = computed(() => getCurrentLanguageTextDirection()); const fontSizePreviewClassName = computed(() => getFontSizePreviewClassName(fontSize.value)); -const currentLongYearMonth = computed(() => getCalendarLongYearMonthFromUnixTime(currentUnixTime.value)); -const currentDayOfMonth = computed(() => getCalendarDayOfMonthFromUnixTime(currentUnixTime.value)); +const currentLongYearMonth = computed(() => formatUnixTimeToGregorianLikeLongYearMonth(currentUnixTime.value)); +const currentDayOfMonth = computed(() => getCalendarDisplayDayOfMonthFromUnixTime(currentUnixTime.value)); const currentDayOfWeek = computed(() => getWeekdayShortName(parseDateTimeFromUnixTime(currentUnixTime.value).getWeekDay())); const currentShortTime = computed(() => formatUnixTimeToShortTime(currentUnixTime.value)); diff --git a/src/views/mobile/transactions/EditPage.vue b/src/views/mobile/transactions/EditPage.vue index e9887dcf..af3ca48f 100644 --- a/src/views/mobile/transactions/EditPage.vue +++ b/src/views/mobile/transactions/EditPage.vue @@ -536,7 +536,7 @@ const { getMultiWeekdayLongNames, formatUnixTimeToLongDate, formatUnixTimeToLongTime, - formatGregorianCalendarYearDashMonthDashDayToLongDate + formatGregorianTextualYearMonthDayToLongDate } = useI18n(); const { showAlert, showConfirm, showToast, routeBackOnError } = useI18nUIComponents(); @@ -756,7 +756,7 @@ const transactionDisplayScheduledStartDate = computed(() => { 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(() => { const template = transaction.value as TransactionTemplate; if (template.scheduledEndDate) { - return formatGregorianCalendarYearDashMonthDashDayToLongDate(template.scheduledEndDate); + return formatGregorianTextualYearMonthDayToLongDate(template.scheduledEndDate); } else { return tt('No limit'); } diff --git a/src/views/mobile/transactions/ListPage.vue b/src/views/mobile/transactions/ListPage.vue index 94598464..b6ed9b6d 100644 --- a/src/views/mobile/transactions/ListPage.vue +++ b/src/views/mobile/transactions/ListPage.vue @@ -202,7 +202,7 @@