mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
reconciliation statement page / dialog supports account balance trends chart (#184)
This commit is contained in:
+27
-1
@@ -147,6 +147,7 @@ import {
|
||||
getTimezoneOffset,
|
||||
getTimezoneOffsetMinutes,
|
||||
getYear,
|
||||
getQuarter,
|
||||
isDateRangeMatchFullMonths,
|
||||
isDateRangeMatchFullYears,
|
||||
isPM,
|
||||
@@ -496,6 +497,22 @@ export function useI18n() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getLocalizedChartDateAggregationTypeAndDisplayName(fullName: boolean): TypeAndDisplayName[] {
|
||||
const ret: TypeAndDisplayName[] = [];
|
||||
const allTypes: ChartDateAggregationType[] = ChartDateAggregationType.values();
|
||||
|
||||
for (let i = 0; i < allTypes.length; i++) {
|
||||
const type = allTypes[i];
|
||||
|
||||
ret.push({
|
||||
type: type.type,
|
||||
displayName: t(fullName ? type.fullName : `granularity.${type.shortName}`)
|
||||
});
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getAllMonthNames(type: string): string[] {
|
||||
const ret = [];
|
||||
const allMonths = Month.values();
|
||||
@@ -1472,6 +1489,13 @@ export function useI18n() {
|
||||
return formatMonthDay(monthDay, getLocalizedLongMonthDayFormat());
|
||||
}
|
||||
|
||||
function formatUnixTimeToYearQuarter(unixTime: number): string {
|
||||
const date = parseDateFromUnixTime(unixTime);
|
||||
const year = getYear(date);
|
||||
const quarter = getQuarter(date);
|
||||
return formatYearQuarter(year, quarter);
|
||||
}
|
||||
|
||||
function formatYearQuarter(year: number, quarter: number): string {
|
||||
if (1 <= quarter && quarter <= 4) {
|
||||
return t('format.yearQuarter.q' + quarter, {
|
||||
@@ -1912,7 +1936,8 @@ export function useI18n() {
|
||||
getAllTrendChartTypes: () => getLocalizedDisplayNameAndType(TrendChartType.values()),
|
||||
getAllStatisticsChartDataTypes: (analysisType: StatisticsAnalysisType) => getLocalizedDisplayNameAndType(ChartDataType.values(analysisType)),
|
||||
getAllStatisticsSortingTypes: () => getLocalizedDisplayNameAndType(ChartSortingType.values()),
|
||||
getAllStatisticsDateAggregationTypes: () => getLocalizedDisplayNameAndType(ChartDateAggregationType.values()),
|
||||
getAllStatisticsDateAggregationTypes: () => getLocalizedChartDateAggregationTypeAndDisplayName(true),
|
||||
getAllStatisticsDateAggregationTypesWithShortName: () => getLocalizedChartDateAggregationTypeAndDisplayName(false),
|
||||
getAllTransactionEditScopeTypes: () => getLocalizedDisplayNameAndType(TransactionEditScopeType.values()),
|
||||
getAllTransactionTagFilterTypes: () => getLocalizedDisplayNameAndType(TransactionTagFilterType.values()),
|
||||
getAllTransactionScheduledFrequencyTypes: () => getLocalizedDisplayNameAndType(ScheduledTemplateFrequencyType.values()),
|
||||
@@ -1961,6 +1986,7 @@ export function useI18n() {
|
||||
formatUnixTimeToShortTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortTimeFormat(), utcOffset, currentUtcOffset),
|
||||
formatDateToLongDate,
|
||||
formatMonthDayToLongDay,
|
||||
formatUnixTimeToYearQuarter,
|
||||
formatYearQuarter,
|
||||
formatDateRange,
|
||||
formatFiscalYearStartToLongDay,
|
||||
|
||||
Reference in New Issue
Block a user