mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 17:54:30 +08:00
code refactor
This commit is contained in:
@@ -42,7 +42,7 @@ export interface TrendsBarChartClickEvent {
|
|||||||
export function useTrendsChartBase<T extends YearMonth>(props: CommonTrendsChartProps<T>) {
|
export function useTrendsChartBase<T extends YearMonth>(props: CommonTrendsChartProps<T>) {
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
|
|
||||||
const allDateRanges = computed<YearUnixTime[] | YearQuarterUnixTime[] | YearMonthUnixTime[] | FiscalYearUnixTime[]>(() => getAllDateRanges(props.items, props.startYearMonth, props.endYearMonth, props.fiscalYearStart, props.dateAggregationType));
|
const allDateRanges = computed<YearUnixTime[] | FiscalYearUnixTime[] | YearQuarterUnixTime[] | YearMonthUnixTime[]>(() => getAllDateRanges(props.items, props.startYearMonth, props.endYearMonth, props.fiscalYearStart, props.dateAggregationType));
|
||||||
|
|
||||||
function getItemName(name: string): string {
|
function getItemName(name: string): string {
|
||||||
return props.translateName ? tt(name) : name;
|
return props.translateName ? tt(name) : name;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export function sortStatisticsItems<T extends SortableTransactionStatisticDataIt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAllDateRanges<T extends YearMonth>(items: YearMonthItems<T>[], startYearMonth: YearMonth | string, endYearMonth: YearMonth | string, fiscalYearStart: number, dateAggregationType: number): YearUnixTime[] | YearQuarterUnixTime[] | YearMonthUnixTime[] | FiscalYearUnixTime[] {
|
export function getAllDateRanges<T extends YearMonth>(items: YearMonthItems<T>[], startYearMonth: YearMonth | string, endYearMonth: YearMonth | string, fiscalYearStart: number, dateAggregationType: number): YearUnixTime[] | FiscalYearUnixTime[] | YearQuarterUnixTime[] | YearMonthUnixTime[] {
|
||||||
if ((!startYearMonth || !endYearMonth) && items && items.length) {
|
if ((!startYearMonth || !endYearMonth) && items && items.length) {
|
||||||
let minYear = Number.MAX_SAFE_INTEGER, minMonth = Number.MAX_SAFE_INTEGER, maxYear = 0, maxMonth = 0;
|
let minYear = Number.MAX_SAFE_INTEGER, minMonth = Number.MAX_SAFE_INTEGER, maxYear = 0, maxMonth = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user