mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 01:34:24 +08:00
use and display the Gregorian calendar when calculating months, quarters, years, and fiscal years
This commit is contained in:
@@ -51,7 +51,13 @@ export interface CommonAccountBalanceTrendsChartProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function useAccountBalanceTrendsChartBase(props: CommonAccountBalanceTrendsChartProps) {
|
export function useAccountBalanceTrendsChartBase(props: CommonAccountBalanceTrendsChartProps) {
|
||||||
const { formatUnixTimeToShortDate, formatUnixTimeToShortYear, formatUnixTimeToShortYearMonth, formatUnixTimeToYearQuarter, formatUnixTimeToFiscalYear } = useI18n();
|
const {
|
||||||
|
getCalendarShortYearFromUnixTime,
|
||||||
|
getCalendarShortYearMonthFromUnixTime,
|
||||||
|
getCalendarYearQuarterFromUnixTime,
|
||||||
|
getCalendarFiscalYearFromUnixTime,
|
||||||
|
formatUnixTimeToShortDate
|
||||||
|
} = useI18n();
|
||||||
|
|
||||||
const dataDateRange = computed<AccountBalanceUnixTimeAndBalanceRange | null>(() => {
|
const dataDateRange = computed<AccountBalanceUnixTimeAndBalanceRange | null>(() => {
|
||||||
if (!props.items || props.items.length < 1) {
|
if (!props.items || props.items.length < 1) {
|
||||||
@@ -150,13 +156,13 @@ export function useAccountBalanceTrendsChartBase(props: CommonAccountBalanceTren
|
|||||||
let displayDate = '';
|
let displayDate = '';
|
||||||
|
|
||||||
if (props.dateAggregationType === ChartDateAggregationType.Year.type) {
|
if (props.dateAggregationType === ChartDateAggregationType.Year.type) {
|
||||||
displayDate = formatUnixTimeToShortYear(dateRange.minUnixTime);
|
displayDate = getCalendarShortYearFromUnixTime(dateRange.minUnixTime);
|
||||||
} else if (props.dateAggregationType === ChartDateAggregationType.FiscalYear.type) {
|
} else if (props.dateAggregationType === ChartDateAggregationType.FiscalYear.type) {
|
||||||
displayDate = formatUnixTimeToFiscalYear(dateRange.minUnixTime);
|
displayDate = getCalendarFiscalYearFromUnixTime(dateRange.minUnixTime);
|
||||||
} else if (props.dateAggregationType === ChartDateAggregationType.Quarter.type) {
|
} else if (props.dateAggregationType === ChartDateAggregationType.Quarter.type) {
|
||||||
displayDate = formatUnixTimeToYearQuarter(dateRange.minUnixTime);
|
displayDate = getCalendarYearQuarterFromUnixTime(dateRange.minUnixTime);
|
||||||
} else if (props.dateAggregationType === ChartDateAggregationType.Month.type) {
|
} else if (props.dateAggregationType === ChartDateAggregationType.Month.type) {
|
||||||
displayDate = formatUnixTimeToShortYearMonth(dateRange.minUnixTime);
|
displayDate = getCalendarShortYearMonthFromUnixTime(dateRange.minUnixTime);
|
||||||
} else {
|
} else {
|
||||||
displayDate = formatUnixTimeToShortDate(dateRange.minUnixTime);
|
displayDate = formatUnixTimeToShortDate(dateRange.minUnixTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function getFiscalYearStartFromProps(props: CommonFiscalYearStartSelectionProps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function useFiscalYearStartSelectionBase(props: CommonFiscalYearStartSelectionProps) {
|
export function useFiscalYearStartSelectionBase(props: CommonFiscalYearStartSelectionProps) {
|
||||||
const { formatGregorianCalendarMonthDashDayToLongMonthDay } = useI18n();
|
const { getCalendarLongMonthDayFromGregorianCalendarTextualMonthDay } = useI18n();
|
||||||
|
|
||||||
const disabledDates = (date: Date) => {
|
const disabledDates = (date: Date) => {
|
||||||
// Disable February 29 (leap day)
|
// Disable February 29 (leap day)
|
||||||
@@ -71,7 +71,7 @@ export function useFiscalYearStartSelectionBase(props: CommonFiscalYearStartSele
|
|||||||
fiscalYearStart = FiscalYearStart.Default;
|
fiscalYearStart = FiscalYearStart.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
return formatGregorianCalendarMonthDashDayToLongMonthDay(fiscalYearStart.toMonthDashDayString());
|
return getCalendarLongMonthDayFromGregorianCalendarTextualMonthDay(fiscalYearStart.toMonthDashDayString());
|
||||||
});
|
});
|
||||||
|
|
||||||
const allowedMinDate = computed<Date>(() => getLocalDatetimeFromUnixTime(getThisYearFirstUnixTime()));
|
const allowedMinDate = computed<Date>(() => getLocalDatetimeFromUnixTime(getThisYearFirstUnixTime()));
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ function getMonthRangeFromProps(props: CommonMonthRangeSelectionProps): { minDat
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function useMonthRangeSelectionBase(props: CommonMonthRangeSelectionProps) {
|
export function useMonthRangeSelectionBase(props: CommonMonthRangeSelectionProps) {
|
||||||
const { formatUnixTimeToLongYearMonth } = useI18n();
|
const { getCalendarLongYearMonthFromUnixTime } = useI18n();
|
||||||
const { minDate, maxDate } = getMonthRangeFromProps(props);
|
const { minDate, maxDate } = getMonthRangeFromProps(props);
|
||||||
|
|
||||||
const dateRange = ref<Year0BasedMonth[]>([
|
const dateRange = ref<Year0BasedMonth[]>([
|
||||||
@@ -57,8 +57,8 @@ export function useMonthRangeSelectionBase(props: CommonMonthRangeSelectionProps
|
|||||||
maxDate
|
maxDate
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const beginDateTime = computed<string>(() => formatUnixTimeToLongYearMonth(getYearMonthFirstUnixTime(dateRange.value[0])));
|
const beginDateTime = computed<string>(() => getCalendarLongYearMonthFromUnixTime(getYearMonthFirstUnixTime(dateRange.value[0])));
|
||||||
const endDateTime = computed<string>(() => formatUnixTimeToLongYearMonth(getYearMonthLastUnixTime(dateRange.value[1])));
|
const endDateTime = computed<string>(() => getCalendarLongYearMonthFromUnixTime(getYearMonthLastUnixTime(dateRange.value[1])));
|
||||||
|
|
||||||
function getFinalMonthRange(): { minYearMonth: TextualYearMonth | '', maxYearMonth: TextualYearMonth | '' } | null {
|
function getFinalMonthRange(): { minYearMonth: TextualYearMonth | '', maxYearMonth: TextualYearMonth | '' } | null {
|
||||||
if (!dateRange.value[0] || !dateRange.value[1]) {
|
if (!dateRange.value[0] || !dateRange.value[1]) {
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ const theme = useTheme();
|
|||||||
const {
|
const {
|
||||||
tt,
|
tt,
|
||||||
getCurrentLanguageTextDirection,
|
getCurrentLanguageTextDirection,
|
||||||
formatUnixTimeToShortYear,
|
getCalendarShortYearFromUnixTime,
|
||||||
formatYearQuarter,
|
getCalendarShortYearMonthFromUnixTime,
|
||||||
formatUnixTimeToShortYearMonth,
|
getCalendarYearQuarterFromYearQuarter,
|
||||||
formatUnixTimeToFiscalYear,
|
getCalendarFiscalYearFromUnixTime,
|
||||||
formatAmountToWesternArabicNumeralsWithoutDigitGrouping,
|
formatAmountToWesternArabicNumeralsWithoutDigitGrouping,
|
||||||
formatAmountToLocalizedNumeralsWithCurrency
|
formatAmountToLocalizedNumeralsWithCurrency
|
||||||
} = useI18n();
|
} = useI18n();
|
||||||
@@ -139,13 +139,13 @@ const allDisplayDateRanges = computed<string[]>(() => {
|
|||||||
const dateRange = allDateRanges.value[i];
|
const dateRange = allDateRanges.value[i];
|
||||||
|
|
||||||
if (props.dateAggregationType === ChartDateAggregationType.Year.type) {
|
if (props.dateAggregationType === ChartDateAggregationType.Year.type) {
|
||||||
allDisplayDateRanges.push(formatUnixTimeToShortYear(dateRange.minUnixTime));
|
allDisplayDateRanges.push(getCalendarShortYearFromUnixTime(dateRange.minUnixTime));
|
||||||
} else if (props.dateAggregationType === ChartDateAggregationType.FiscalYear.type && 'year' in dateRange) {
|
} else if (props.dateAggregationType === ChartDateAggregationType.FiscalYear.type && 'year' in dateRange) {
|
||||||
allDisplayDateRanges.push(formatUnixTimeToFiscalYear(dateRange.minUnixTime));
|
allDisplayDateRanges.push(getCalendarFiscalYearFromUnixTime(dateRange.minUnixTime));
|
||||||
} else if (props.dateAggregationType === ChartDateAggregationType.Quarter.type && 'quarter' in dateRange) {
|
} else if (props.dateAggregationType === ChartDateAggregationType.Quarter.type && 'quarter' in dateRange) {
|
||||||
allDisplayDateRanges.push(formatYearQuarter(dateRange.year, dateRange.quarter));
|
allDisplayDateRanges.push(getCalendarYearQuarterFromYearQuarter(dateRange.year, dateRange.quarter));
|
||||||
} else { // if (props.dateAggregationType === ChartDateAggregationType.Month.type) {
|
} else { // if (props.dateAggregationType === ChartDateAggregationType.Month.type) {
|
||||||
allDisplayDateRanges.push(formatUnixTimeToShortYearMonth(dateRange.minUnixTime));
|
allDisplayDateRanges.push(getCalendarShortYearMonthFromUnixTime(dateRange.minUnixTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -156,10 +156,10 @@ const emit = defineEmits<{
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
tt,
|
tt,
|
||||||
formatUnixTimeToShortYear,
|
getCalendarShortYearFromUnixTime,
|
||||||
formatYearQuarter,
|
getCalendarShortYearMonthFromUnixTime,
|
||||||
formatUnixTimeToShortYearMonth,
|
getCalendarYearQuarterFromYearQuarter,
|
||||||
formatUnixTimeToFiscalYear,
|
getCalendarFiscalYearFromUnixTime,
|
||||||
formatAmountToLocalizedNumeralsWithCurrency
|
formatAmountToLocalizedNumeralsWithCurrency
|
||||||
} = useI18n();
|
} = useI18n();
|
||||||
|
|
||||||
@@ -250,13 +250,13 @@ const allDisplayDataItems = computed<MonthlyTrendsBarChartData>(() => {
|
|||||||
let displayDateRange = '';
|
let displayDateRange = '';
|
||||||
|
|
||||||
if (props.dateAggregationType === ChartDateAggregationType.Year.type) {
|
if (props.dateAggregationType === ChartDateAggregationType.Year.type) {
|
||||||
displayDateRange = formatUnixTimeToShortYear(dateRange.minUnixTime);
|
displayDateRange = getCalendarShortYearFromUnixTime(dateRange.minUnixTime);
|
||||||
} else if (props.dateAggregationType === ChartDateAggregationType.FiscalYear.type) {
|
} else if (props.dateAggregationType === ChartDateAggregationType.FiscalYear.type) {
|
||||||
displayDateRange = formatUnixTimeToFiscalYear(dateRange.minUnixTime);
|
displayDateRange = getCalendarFiscalYearFromUnixTime(dateRange.minUnixTime);
|
||||||
} else if (props.dateAggregationType === ChartDateAggregationType.Quarter.type && 'quarter' in dateRange) {
|
} else if (props.dateAggregationType === ChartDateAggregationType.Quarter.type && 'quarter' in dateRange) {
|
||||||
displayDateRange = formatYearQuarter(dateRange.year, dateRange.quarter);
|
displayDateRange = getCalendarYearQuarterFromYearQuarter(dateRange.year, dateRange.quarter);
|
||||||
} else { // if (props.dateAggregationType === ChartDateAggregationType.Month.type) {
|
} else { // if (props.dateAggregationType === ChartDateAggregationType.Month.type) {
|
||||||
displayDateRange = formatUnixTimeToShortYearMonth(dateRange.minUnixTime);
|
displayDateRange = getCalendarShortYearMonthFromUnixTime(dateRange.minUnixTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataItems = allDateRangeItemsMap[dateRangeKey] || [];
|
const dataItems = allDateRangeItemsMap[dateRangeKey] || [];
|
||||||
|
|||||||
+6
-6
@@ -368,25 +368,25 @@ class MomentDateTime implements DateTime {
|
|||||||
return this.persianDateInfo;
|
return this.persianDateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static isYearFirstTime(dateTime: MomentDateTime): boolean {
|
static isGregorianCalendarYearFirstTime(dateTime: MomentDateTime): boolean {
|
||||||
const currentUnixTime = dateTime.instance.clone().set({ millisecond: 0 }).unix();
|
const currentUnixTime = dateTime.instance.clone().set({ millisecond: 0 }).unix();
|
||||||
const expectedUnxTime = dateTime.instance.clone().set({ millisecond: 0 }).startOf('year').unix();
|
const expectedUnxTime = dateTime.instance.clone().set({ millisecond: 0 }).startOf('year').unix();
|
||||||
return currentUnixTime === expectedUnxTime;
|
return currentUnixTime === expectedUnxTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
static isYearLastTime(dateTime: MomentDateTime): boolean {
|
static isGregorianCalendarYearLastTime(dateTime: MomentDateTime): boolean {
|
||||||
const currentUnixTime = dateTime.instance.clone().set({ millisecond: 999 }).unix();
|
const currentUnixTime = dateTime.instance.clone().set({ millisecond: 999 }).unix();
|
||||||
const expectedUnxTime = dateTime.instance.clone().set({ millisecond: 999 }).endOf('year').unix();
|
const expectedUnxTime = dateTime.instance.clone().set({ millisecond: 999 }).endOf('year').unix();
|
||||||
return currentUnixTime === expectedUnxTime;
|
return currentUnixTime === expectedUnxTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
static isMonthFirstTime(dateTime: MomentDateTime): boolean {
|
static isGregorianCalendarMonthFirstTime(dateTime: MomentDateTime): boolean {
|
||||||
const currentUnixTime = dateTime.instance.clone().set({ millisecond: 0 }).unix();
|
const currentUnixTime = dateTime.instance.clone().set({ millisecond: 0 }).unix();
|
||||||
const expectedUnxTime = dateTime.instance.clone().set({ millisecond: 0 }).startOf('month').unix();
|
const expectedUnxTime = dateTime.instance.clone().set({ millisecond: 0 }).startOf('month').unix();
|
||||||
return currentUnixTime === expectedUnxTime;
|
return currentUnixTime === expectedUnxTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
static isMonthLastTime(dateTime: MomentDateTime): boolean {
|
static isGregorianCalendarMonthLastTime(dateTime: MomentDateTime): boolean {
|
||||||
const currentUnixTime = dateTime.instance.clone().set({ millisecond: 999 }).unix();
|
const currentUnixTime = dateTime.instance.clone().set({ millisecond: 999 }).unix();
|
||||||
const expectedUnxTime = dateTime.instance.clone().set({ millisecond: 999 }).endOf('month').unix();
|
const expectedUnxTime = dateTime.instance.clone().set({ millisecond: 999 }).endOf('month').unix();
|
||||||
return currentUnixTime === expectedUnxTime;
|
return currentUnixTime === expectedUnxTime;
|
||||||
@@ -1373,13 +1373,13 @@ export function getValidMonthDayOrCurrentDayShortDate(unixTime: number, currentS
|
|||||||
export function isDateRangeMatchFullYears(minTime: number, maxTime: number): boolean {
|
export function isDateRangeMatchFullYears(minTime: number, maxTime: number): boolean {
|
||||||
const minDateTime = parseDateTimeFromUnixTime(minTime);
|
const minDateTime = parseDateTimeFromUnixTime(minTime);
|
||||||
const maxDateTime = parseDateTimeFromUnixTime(maxTime);
|
const maxDateTime = parseDateTimeFromUnixTime(maxTime);
|
||||||
return MomentDateTime.isYearFirstTime(minDateTime as MomentDateTime) && MomentDateTime.isYearLastTime(maxDateTime as MomentDateTime);
|
return MomentDateTime.isGregorianCalendarYearFirstTime(minDateTime as MomentDateTime) && MomentDateTime.isGregorianCalendarYearLastTime(maxDateTime as MomentDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDateRangeMatchFullMonths(minTime: number, maxTime: number): boolean {
|
export function isDateRangeMatchFullMonths(minTime: number, maxTime: number): boolean {
|
||||||
const minDateTime = parseDateTimeFromUnixTime(minTime);
|
const minDateTime = parseDateTimeFromUnixTime(minTime);
|
||||||
const maxDateTime = parseDateTimeFromUnixTime(maxTime);
|
const maxDateTime = parseDateTimeFromUnixTime(maxTime);
|
||||||
return MomentDateTime.isMonthFirstTime(minDateTime as MomentDateTime) && MomentDateTime.isMonthLastTime(maxDateTime as MomentDateTime);
|
return MomentDateTime.isGregorianCalendarMonthFirstTime(minDateTime as MomentDateTime) && MomentDateTime.isGregorianCalendarMonthLastTime(maxDateTime as MomentDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDateRangeMatchOneMonth(minTime: number, maxTime: number): boolean {
|
export function isDateRangeMatchOneMonth(minTime: number, maxTime: number): boolean {
|
||||||
|
|||||||
+53
-48
@@ -778,6 +778,30 @@ export function useI18n() {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatTimeRangeToFiscalYearFormat(format: FiscalYearFormat, timeRange: FiscalYearUnixTime | UnixTimeRange, numeralSystem?: NumeralSystem, calendarType?: CalendarType): string {
|
||||||
|
if (!format) {
|
||||||
|
format = FiscalYearFormat.Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentCalendarDisplayType = getCurrentCalendarDisplayType();
|
||||||
|
|
||||||
|
if (!isDefined(calendarType)) {
|
||||||
|
calendarType = currentCalendarDisplayType.primaryCalendarType;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dateTimeFormatOptions = getDateTimeFormatOptions({
|
||||||
|
calendarType: calendarType,
|
||||||
|
numeralSystem: numeralSystem
|
||||||
|
});
|
||||||
|
|
||||||
|
return t('format.fiscalYear.' + format.typeName, {
|
||||||
|
StartYYYY: formatUnixTime(timeRange.minUnixTime, 'YYYY', dateTimeFormatOptions),
|
||||||
|
StartYY: formatUnixTime(timeRange.minUnixTime, 'YY', dateTimeFormatOptions),
|
||||||
|
EndYYYY: formatUnixTime(timeRange.maxUnixTime, 'YYYY', dateTimeFormatOptions),
|
||||||
|
EndYY: formatUnixTime(timeRange.maxUnixTime, 'YY', dateTimeFormatOptions),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function getCurrentCurrencyDisplayType(): CurrencyDisplayType {
|
function getCurrentCurrencyDisplayType(): CurrencyDisplayType {
|
||||||
let currencyDisplayType = CurrencyDisplayType.valueOf(userStore.currentUserCurrencyDisplayType);
|
let currencyDisplayType = CurrencyDisplayType.valueOf(userStore.currentUserCurrencyDisplayType);
|
||||||
|
|
||||||
@@ -1099,7 +1123,8 @@ export function useI18n() {
|
|||||||
function getAllRecentMonthDateRanges(includeAll: boolean, includeCustom: boolean): LocalizedRecentMonthDateRange[] {
|
function getAllRecentMonthDateRanges(includeAll: boolean, includeCustom: boolean): LocalizedRecentMonthDateRange[] {
|
||||||
const allRecentMonthDateRanges: LocalizedRecentMonthDateRange[] = [];
|
const allRecentMonthDateRanges: LocalizedRecentMonthDateRange[] = [];
|
||||||
const recentDateRanges = getRecentMonthDateRanges(12);
|
const recentDateRanges = getRecentMonthDateRanges(12);
|
||||||
const dateTimeFormatOptions = getDateTimeFormatOptions();
|
const currentCalendarDisplayType = getCurrentCalendarDisplayType();
|
||||||
|
const dateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: currentCalendarDisplayType.primaryCalendarType });
|
||||||
|
|
||||||
if (includeAll) {
|
if (includeAll) {
|
||||||
allRecentMonthDateRanges.push({
|
allRecentMonthDateRanges.push({
|
||||||
@@ -1782,23 +1807,21 @@ export function useI18n() {
|
|||||||
return getLocalizedLongTimeFormat().indexOf('ss') >= 0;
|
return getLocalizedLongTimeFormat().indexOf('ss') >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatGregorianCalendarYearDashMonthDashDayToLongDate(date: TextualYearMonthDay): string {
|
function getCalendarLongMonthDayFromGregorianCalendarTextualMonthDay(monthDay: TextualYearMonth): string {
|
||||||
return formatGregorianCalendarYearDashMonthDashDay(date, getLocalizedLongDateFormat(), getDateTimeFormatOptions());
|
const currentCalendarDisplayType = getCurrentCalendarDisplayType();
|
||||||
|
return formatGregorianCalendarMonthDashDay(monthDay, getLocalizedLongMonthDayFormat(), getDateTimeFormatOptions({ calendarType: currentCalendarDisplayType.primaryCalendarType }));
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatGregorianCalendarMonthDashDayToLongMonthDay(monthDay: TextualYearMonth): string {
|
function getCalendarYearQuarterFromUnixTime(unixTime: number): string {
|
||||||
return formatGregorianCalendarMonthDashDay(monthDay, getLocalizedLongMonthDayFormat(), getDateTimeFormatOptions());
|
const currentCalendarDisplayType = getCurrentCalendarDisplayType();
|
||||||
}
|
const dateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: currentCalendarDisplayType.primaryCalendarType });
|
||||||
|
|
||||||
function formatUnixTimeToYearQuarter(unixTime: number): string {
|
|
||||||
const dateTimeFormatOptions = getDateTimeFormatOptions();
|
|
||||||
const date = parseDateTimeFromUnixTime(unixTime);
|
const date = parseDateTimeFromUnixTime(unixTime);
|
||||||
const year = date.getLocalizedCalendarYear(dateTimeFormatOptions);
|
const year = date.getLocalizedCalendarYear(dateTimeFormatOptions);
|
||||||
const quarter = date.getLocalizedCalendarQuarter(dateTimeFormatOptions);
|
const quarter = date.getLocalizedCalendarQuarter(dateTimeFormatOptions);
|
||||||
return formatYearQuarter(year, quarter);
|
return getCalendarYearQuarterFromYearQuarter(year, quarter);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatYearQuarter(year: number | string, quarter: number): string {
|
function getCalendarYearQuarterFromYearQuarter(year: number | string, quarter: number): string {
|
||||||
if (1 <= quarter && quarter <= 4) {
|
if (1 <= quarter && quarter <= 4) {
|
||||||
return t('format.yearQuarter.q' + quarter, {
|
return t('format.yearQuarter.q' + quarter, {
|
||||||
year: year,
|
year: year,
|
||||||
@@ -1815,7 +1838,8 @@ export function useI18n() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const allDateRanges = DateRange.values();
|
const allDateRanges = DateRange.values();
|
||||||
const dateTimeFormatOptions = getDateTimeFormatOptions();
|
const currentCalendarDisplayType = getCurrentCalendarDisplayType();
|
||||||
|
const dateTimeFormatOptions = getDateTimeFormatOptions({ calendarType: currentCalendarDisplayType.primaryCalendarType });
|
||||||
|
|
||||||
for (let i = 0; i < allDateRanges.length; i++) {
|
for (let i = 0; i < allDateRanges.length; i++) {
|
||||||
const dateRange = allDateRanges[i];
|
const dateRange = allDateRanges[i];
|
||||||
@@ -1858,22 +1882,7 @@ export function useI18n() {
|
|||||||
return `${displayStartTime} ~ ${displayEndTime}`;
|
return `${displayStartTime} ~ ${displayEndTime}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatTimeRangeToFiscalYearFormat(format: FiscalYearFormat, timeRange: FiscalYearUnixTime | UnixTimeRange, numeralSystem?: NumeralSystem, calendarType?: CalendarType): string {
|
function getCalendarFiscalYearFromUnixTime(unixTime: number): string {
|
||||||
if (!format) {
|
|
||||||
format = FiscalYearFormat.Default;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dateTimeFormatOptions = getDateTimeFormatOptions({ numeralSystem, calendarType });
|
|
||||||
|
|
||||||
return t('format.fiscalYear.' + format.typeName, {
|
|
||||||
StartYYYY: formatUnixTime(timeRange.minUnixTime, 'YYYY', dateTimeFormatOptions),
|
|
||||||
StartYY: formatUnixTime(timeRange.minUnixTime, 'YY', dateTimeFormatOptions),
|
|
||||||
EndYYYY: formatUnixTime(timeRange.maxUnixTime, 'YYYY', dateTimeFormatOptions),
|
|
||||||
EndYY: formatUnixTime(timeRange.maxUnixTime, 'YY', dateTimeFormatOptions),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatUnixTimeToFiscalYear(unixTime: number): string {
|
|
||||||
let fiscalYearFormat = FiscalYearFormat.valueOf(getCurrentFiscalYearFormatType());
|
let fiscalYearFormat = FiscalYearFormat.valueOf(getCurrentFiscalYearFormatType());
|
||||||
|
|
||||||
if (!fiscalYearFormat) {
|
if (!fiscalYearFormat) {
|
||||||
@@ -1884,7 +1893,7 @@ export function useI18n() {
|
|||||||
return formatTimeRangeToFiscalYearFormat(fiscalYearFormat, timeRange);
|
return formatTimeRangeToFiscalYearFormat(fiscalYearFormat, timeRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatYearToFiscalYear(year: number) {
|
function getCalendarFiscalYearGregorianCalendarYear(year: number) {
|
||||||
let fiscalYearFormat = FiscalYearFormat.valueOf(getCurrentFiscalYearFormatType());
|
let fiscalYearFormat = FiscalYearFormat.valueOf(getCurrentFiscalYearFormatType());
|
||||||
|
|
||||||
if (!fiscalYearFormat) {
|
if (!fiscalYearFormat) {
|
||||||
@@ -1895,14 +1904,14 @@ export function useI18n() {
|
|||||||
return formatTimeRangeToFiscalYearFormat(fiscalYearFormat, timeRange);
|
return formatTimeRangeToFiscalYearFormat(fiscalYearFormat, timeRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatFiscalYearStartToLongDay(fiscalYearStartValue: number) {
|
function getCalendarLongMonthDayFromFiscalYearStart(fiscalYearStartValue: number) {
|
||||||
let fiscalYearStart = FiscalYearStart.valueOf(fiscalYearStartValue);
|
let fiscalYearStart = FiscalYearStart.valueOf(fiscalYearStartValue);
|
||||||
|
|
||||||
if (!fiscalYearStart) {
|
if (!fiscalYearStart) {
|
||||||
fiscalYearStart = FiscalYearStart.Default;
|
fiscalYearStart = FiscalYearStart.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
return formatGregorianCalendarMonthDashDayToLongMonthDay(fiscalYearStart.toMonthDashDayString());
|
return getCalendarLongMonthDayFromGregorianCalendarTextualMonthDay(fiscalYearStart.toMonthDashDayString());
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTimezoneDifferenceDisplayText(utcOffset: number): string {
|
function getTimezoneDifferenceDisplayText(utcOffset: number): string {
|
||||||
@@ -2392,34 +2401,30 @@ export function useI18n() {
|
|||||||
isLongTimeMinuteTwoDigits,
|
isLongTimeMinuteTwoDigits,
|
||||||
isLongTimeSecondTwoDigits,
|
isLongTimeSecondTwoDigits,
|
||||||
// format functions
|
// 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),
|
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),
|
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),
|
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),
|
formatUnixTimeToDefaultDateTimeWithoutLocaleOptions: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, KnownDateTimeFormat.DefaultDateTime.format, getDateTimeFormatOptions({ numeralSystem: NumeralSystem.WesternArabicNumerals, calendarType: CalendarType.Gregorian }), utcOffset, currentUtcOffset),
|
||||||
formatUnixTimeToLongDateTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongDateFormat() + ' ' + getLocalizedLongTimeFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
|
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),
|
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),
|
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),
|
formatUnixTimeToShortDate: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortDateFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
|
||||||
formatUnixTimeToLongYear: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongYearFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
|
|
||||||
formatUnixTimeToShortYear: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortYearFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
|
|
||||||
formatUnixTimeToLongMonth: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, 'MMMM', getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
|
|
||||||
formatUnixTimeToShortMonth: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, 'MMM', getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
|
|
||||||
formatUnixTimeToLongYearMonth: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedLongYearMonthFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
|
|
||||||
formatUnixTimeToShortYearMonth: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortYearMonthFormat(), 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),
|
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),
|
formatUnixTimeToShortTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortTimeFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
|
||||||
formatUnixTimeToDayOfMonth: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortDayFormat(), getDateTimeFormatOptions(), utcOffset, currentUtcOffset),
|
formatGregorianCalendarYearDashMonthDashDayToLongDate: (date: TextualYearMonthDay) => formatGregorianCalendarYearDashMonthDashDay(date, getLocalizedLongDateFormat(), getDateTimeFormatOptions()),
|
||||||
formatGregorianCalendarYearDashMonthDashDayToLongDate,
|
|
||||||
formatGregorianCalendarMonthDashDayToLongMonthDay,
|
|
||||||
formatUnixTimeToYearQuarter,
|
|
||||||
formatYearQuarter,
|
|
||||||
formatDateRange,
|
formatDateRange,
|
||||||
formatFiscalYearStartToLongDay,
|
|
||||||
formatTimeRangeToFiscalYearFormat,
|
|
||||||
formatUnixTimeToFiscalYear,
|
|
||||||
formatYearToFiscalYear,
|
|
||||||
getTimezoneDifferenceDisplayText,
|
getTimezoneDifferenceDisplayText,
|
||||||
getCalendarAlternateDates,
|
getCalendarAlternateDates,
|
||||||
getCalendarAlternateDate,
|
getCalendarAlternateDate,
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ import type {
|
|||||||
export function useHomePageBase() {
|
export function useHomePageBase() {
|
||||||
const {
|
const {
|
||||||
formatUnixTimeToLongDate,
|
formatUnixTimeToLongDate,
|
||||||
formatUnixTimeToLongYear,
|
getCalendarLongYearFromUnixTime,
|
||||||
formatUnixTimeToLongMonth,
|
getCalendarLongMonthFromUnixTime,
|
||||||
formatUnixTimeToLongMonthDay,
|
getCalendarLongMonthDayFromUnixTime,
|
||||||
formatAmountToLocalizedNumeralsWithCurrency
|
formatAmountToLocalizedNumeralsWithCurrency
|
||||||
} = useI18n();
|
} = useI18n();
|
||||||
|
|
||||||
@@ -60,16 +60,16 @@ export function useHomePageBase() {
|
|||||||
displayTime: formatUnixTimeToLongDate(overviewStore.transactionDataRange.today.startTime),
|
displayTime: formatUnixTimeToLongDate(overviewStore.transactionDataRange.today.startTime),
|
||||||
},
|
},
|
||||||
thisWeek: {
|
thisWeek: {
|
||||||
startTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisWeek.startTime),
|
startTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisWeek.startTime),
|
||||||
endTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisWeek.endTime)
|
endTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisWeek.endTime)
|
||||||
},
|
},
|
||||||
thisMonth: {
|
thisMonth: {
|
||||||
displayTime: formatUnixTimeToLongMonth(overviewStore.transactionDataRange.thisMonth.startTime),
|
displayTime: getCalendarLongMonthFromUnixTime(overviewStore.transactionDataRange.thisMonth.startTime),
|
||||||
startTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisMonth.startTime),
|
startTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisMonth.startTime),
|
||||||
endTime: formatUnixTimeToLongMonthDay(overviewStore.transactionDataRange.thisMonth.endTime)
|
endTime: getCalendarLongMonthDayFromUnixTime(overviewStore.transactionDataRange.thisMonth.endTime)
|
||||||
},
|
},
|
||||||
thisYear: {
|
thisYear: {
|
||||||
displayTime: formatUnixTimeToLongYear(overviewStore.transactionDataRange.thisYear.startTime)
|
displayTime: getCalendarLongYearFromUnixTime(overviewStore.transactionDataRange.thisYear.startTime)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export function useStatisticsTransactionPageBase() {
|
|||||||
getAllStatisticsSortingTypes,
|
getAllStatisticsSortingTypes,
|
||||||
getAllStatisticsDateAggregationTypes,
|
getAllStatisticsDateAggregationTypes,
|
||||||
formatUnixTimeToLongDateTime,
|
formatUnixTimeToLongDateTime,
|
||||||
formatUnixTimeToLongYearMonth,
|
getCalendarLongYearMonthFromUnixTime,
|
||||||
formatDateRange,
|
formatDateRange,
|
||||||
formatAmountToLocalizedNumeralsWithCurrency
|
formatAmountToLocalizedNumeralsWithCurrency
|
||||||
} = useI18n();
|
} = useI18n();
|
||||||
@@ -76,7 +76,7 @@ export function useStatisticsTransactionPageBase() {
|
|||||||
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis) {
|
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis) {
|
||||||
return formatUnixTimeToLongDateTime(query.value.categoricalChartStartTime);
|
return formatUnixTimeToLongDateTime(query.value.categoricalChartStartTime);
|
||||||
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis) {
|
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis) {
|
||||||
return formatUnixTimeToLongYearMonth(getYearMonthFirstUnixTime(query.value.trendChartStartYearMonth));
|
return getCalendarLongYearMonthFromUnixTime(getYearMonthFirstUnixTime(query.value.trendChartStartYearMonth));
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ export function useStatisticsTransactionPageBase() {
|
|||||||
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis) {
|
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis) {
|
||||||
return formatUnixTimeToLongDateTime(query.value.categoricalChartEndTime);
|
return formatUnixTimeToLongDateTime(query.value.categoricalChartEndTime);
|
||||||
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis) {
|
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis) {
|
||||||
return formatUnixTimeToLongYearMonth(getYearMonthLastUnixTime(query.value.trendChartEndYearMonth));
|
return getCalendarLongYearMonthFromUnixTime(getYearMonthLastUnixTime(query.value.trendChartEndYearMonth));
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export function useTransactionListPageBase() {
|
|||||||
getCurrentNumeralSystemType,
|
getCurrentNumeralSystemType,
|
||||||
formatUnixTimeToLongDateTime,
|
formatUnixTimeToLongDateTime,
|
||||||
formatUnixTimeToLongDate,
|
formatUnixTimeToLongDate,
|
||||||
formatUnixTimeToLongYearMonth,
|
getCalendarLongYearMonthFromUnixTime,
|
||||||
formatUnixTimeToShortTime,
|
formatUnixTimeToShortTime,
|
||||||
formatDateRange,
|
formatDateRange,
|
||||||
formatAmountToLocalizedNumeralsWithCurrency
|
formatAmountToLocalizedNumeralsWithCurrency
|
||||||
@@ -287,7 +287,7 @@ export function useTransactionListPageBase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDisplayLongYearMonth(transactionMonthList: TransactionMonthList): string {
|
function getDisplayLongYearMonth(transactionMonthList: TransactionMonthList): string {
|
||||||
return formatUnixTimeToLongYearMonth(getYearMonthFirstUnixTime(transactionMonthList.yearDashMonth));
|
return getCalendarLongYearMonthFromUnixTime(getYearMonthFirstUnixTime(transactionMonthList.yearDashMonth));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDisplayTimezone(transaction: Transaction): string {
|
function getDisplayTimezone(transaction: Transaction): string {
|
||||||
|
|||||||
@@ -60,7 +60,12 @@ const emit = defineEmits<{
|
|||||||
(e: 'click', event: MonthlyIncomeAndExpenseCardClickEvent): void;
|
(e: 'click', event: MonthlyIncomeAndExpenseCardClickEvent): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { tt, getCurrentLanguageTextDirection, formatUnixTimeToShortMonth, formatAmountToLocalizedNumeralsWithCurrency } = useI18n();
|
const {
|
||||||
|
tt,
|
||||||
|
getCurrentLanguageTextDirection,
|
||||||
|
getCalendarShortMonthFromUnixTime,
|
||||||
|
formatAmountToLocalizedNumeralsWithCurrency
|
||||||
|
} = useI18n();
|
||||||
|
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
@@ -96,7 +101,7 @@ const chartOptions = computed<object>(() => {
|
|||||||
if (props.data) {
|
if (props.data) {
|
||||||
for (let i = 0; i < props.data.length; i++) {
|
for (let i = 0; i < props.data.length; i++) {
|
||||||
const item = props.data[i];
|
const item = props.data[i];
|
||||||
const monthShortName = formatUnixTimeToShortMonth(item.monthStartTime);
|
const monthShortName = getCalendarShortMonthFromUnixTime(item.monthStartTime);
|
||||||
|
|
||||||
monthNames.push(monthShortName);
|
monthNames.push(monthShortName);
|
||||||
incomeAmounts.push(item.incomeAmount);
|
incomeAmounts.push(item.incomeAmount);
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ const {
|
|||||||
tt,
|
tt,
|
||||||
getCurrentLanguageTextDirection,
|
getCurrentLanguageTextDirection,
|
||||||
getWeekdayShortName,
|
getWeekdayShortName,
|
||||||
formatUnixTimeToLongYearMonth,
|
getCalendarLongYearMonthFromUnixTime,
|
||||||
formatUnixTimeToShortTime,
|
formatUnixTimeToShortTime,
|
||||||
formatUnixTimeToDayOfMonth,
|
getCalendarDayOfMonthFromUnixTime,
|
||||||
formatAmountToLocalizedNumeralsWithCurrency
|
formatAmountToLocalizedNumeralsWithCurrency
|
||||||
} = useI18n();
|
} = useI18n();
|
||||||
|
|
||||||
@@ -149,8 +149,8 @@ const fontSize = ref<number>(settingsStore.appSettings.fontSize);
|
|||||||
|
|
||||||
const textDirection = computed<string>(() => getCurrentLanguageTextDirection());
|
const textDirection = computed<string>(() => getCurrentLanguageTextDirection());
|
||||||
const fontSizePreviewClassName = computed<string>(() => getFontSizePreviewClassName(fontSize.value));
|
const fontSizePreviewClassName = computed<string>(() => getFontSizePreviewClassName(fontSize.value));
|
||||||
const currentLongYearMonth = computed<string>(() => formatUnixTimeToLongYearMonth(currentUnixTime.value));
|
const currentLongYearMonth = computed<string>(() => getCalendarLongYearMonthFromUnixTime(currentUnixTime.value));
|
||||||
const currentDayOfMonth = computed<string>(() => formatUnixTimeToDayOfMonth(currentUnixTime.value));
|
const currentDayOfMonth = computed<string>(() => getCalendarDayOfMonthFromUnixTime(currentUnixTime.value));
|
||||||
const currentDayOfWeek = computed<string>(() => getWeekdayShortName(parseDateTimeFromUnixTime(currentUnixTime.value).getWeekDay()));
|
const currentDayOfWeek = computed<string>(() => getWeekdayShortName(parseDateTimeFromUnixTime(currentUnixTime.value).getWeekDay()));
|
||||||
const currentShortTime = computed<string>(() => formatUnixTimeToShortTime(currentUnixTime.value));
|
const currentShortTime = computed<string>(() => formatUnixTimeToShortTime(currentUnixTime.value));
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@
|
|||||||
<template #media>
|
<template #media>
|
||||||
<div class="display-flex flex-direction-column transaction-date" :style="getTransactionDateStyle(transaction, idx > 0 ? transactionMonthList.items[idx - 1] : null)">
|
<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">
|
<span class="transaction-day full-line flex-direction-column">
|
||||||
{{ formatUnixTimeToDayOfMonth(transaction.time) }}
|
{{ getCalendarDayOfMonthFromUnixTime(transaction.time) }}
|
||||||
</span>
|
</span>
|
||||||
<span class="transaction-day-of-week full-line flex-direction-column" v-if="transaction.displayDayOfWeek">
|
<span class="transaction-day-of-week full-line flex-direction-column" v-if="transaction.displayDayOfWeek">
|
||||||
{{ getWeekdayShortName(transaction.displayDayOfWeek) }}
|
{{ getWeekdayShortName(transaction.displayDayOfWeek) }}
|
||||||
@@ -646,7 +646,7 @@ const {
|
|||||||
getCurrentLanguageTextDirection,
|
getCurrentLanguageTextDirection,
|
||||||
getAllTransactionTagFilterTypes,
|
getAllTransactionTagFilterTypes,
|
||||||
getWeekdayShortName,
|
getWeekdayShortName,
|
||||||
formatUnixTimeToDayOfMonth
|
getCalendarDayOfMonthFromUnixTime
|
||||||
} = useI18n();
|
} = useI18n();
|
||||||
|
|
||||||
const { showAlert, showToast, routeBackOnError } = useI18nUIComponents();
|
const { showAlert, showToast, routeBackOnError } = useI18nUIComponents();
|
||||||
|
|||||||
@@ -211,7 +211,7 @@
|
|||||||
link="#" no-chevron
|
link="#" no-chevron
|
||||||
class="list-item-with-header-and-title list-item-no-item-after"
|
class="list-item-with-header-and-title list-item-no-item-after"
|
||||||
:header="tt('Fiscal Year Start Date')"
|
:header="tt('Fiscal Year Start Date')"
|
||||||
:title="formatFiscalYearStartToLongDay(newProfile.fiscalYearStart)"
|
:title="getCalendarLongMonthDayFromFiscalYearStart(newProfile.fiscalYearStart)"
|
||||||
@click="showFiscalYearStartSheet = true"
|
@click="showFiscalYearStartSheet = true"
|
||||||
>
|
>
|
||||||
<fiscal-year-start-selection-sheet
|
<fiscal-year-start-selection-sheet
|
||||||
@@ -587,7 +587,7 @@ const {
|
|||||||
getAllLanguageOptions,
|
getAllLanguageOptions,
|
||||||
getAllCurrencies,
|
getAllCurrencies,
|
||||||
getCurrencyName,
|
getCurrencyName,
|
||||||
formatFiscalYearStartToLongDay
|
getCalendarLongMonthDayFromFiscalYearStart
|
||||||
} = useI18n();
|
} = useI18n();
|
||||||
|
|
||||||
const { showAlert, showToast, routeBackOnError } = useI18nUIComponents();
|
const { showAlert, showToast, routeBackOnError } = useI18nUIComponents();
|
||||||
|
|||||||
Reference in New Issue
Block a user