code refactor

This commit is contained in:
MaysWind
2025-06-09 23:32:19 +08:00
parent cd37e2ab1d
commit 4111eb0838
27 changed files with 73 additions and 56 deletions
@@ -1,6 +1,6 @@
import { ref, computed } from 'vue';
import { type TimeRangeAndDateType, type PresetDateRange, type UnixTimeRange, DateRange } from '@/core/datetime.ts';
import { type TimeRangeAndDateType, type PresetDateRange, type UnixTimeRange, type WeekDayValue, DateRange } from '@/core/datetime.ts';
import { arrangeArrayWithNewStartIndex } from '@/lib/common.ts';
import {
getCurrentUnixTime,
@@ -60,7 +60,7 @@ export function useDateRangeSelectionBase(props: CommonDateRangeSelectionProps)
getLocalDatetimeFromUnixTime(getDummyUnixTimeForLocalUsage(maxDate, getTimezoneOffsetMinutes(), getBrowserTimezoneOffsetMinutes()))
]);
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
const firstDayOfWeek = computed<WeekDayValue>(() => userStore.currentUserFirstDayOfWeek);
const dayNames = computed<string[]>(() => arrangeArrayWithNewStartIndex(getAllMinWeekdayNames(), firstDayOfWeek.value));
const isYearFirst = computed<boolean>(() => isLongDateMonthAfterYear());
const is24Hour = computed<boolean>(() => isLongTime24HourFormat());
@@ -1,5 +1,6 @@
import { ref, computed } from 'vue';
import { type WeekDayValue } from '@/core/datetime.ts';
import { FiscalYearStart } from '@/core/fiscalyear.ts';
import { arrangeArrayWithNewStartIndex } from '@/lib/common.ts';
@@ -78,7 +79,7 @@ export function useFiscalYearStartSelectionBase(props: CommonFiscalYearStartSele
return formatMonthDayToLongDay(fiscalYearStart.toMonthDashDayString());
});
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
const firstDayOfWeek = computed<WeekDayValue>(() => userStore.currentUserFirstDayOfWeek);
const dayNames = computed<string[]>(() => arrangeArrayWithNewStartIndex(getAllMinWeekdayNames(), firstDayOfWeek.value));
return {