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