diff --git a/src/stores/CalendarStore.js b/src/stores/CalendarStore.js index f9b91a2..8b08ac7 100644 --- a/src/stores/CalendarStore.js +++ b/src/stores/CalendarStore.js @@ -6,53 +6,20 @@ import { getLocaleWeekendDays, } from '@/utils/date' -/** - * Calendar configuration can be overridden via window.calendarConfig: - * - * window.calendarConfig = { - * firstDay: 0, // 0=Sunday, 1=Monday, etc. (default: 1) - * firstDay: 'auto', // Use locale detection - * weekendDays: [true, false, false, false, false, false, true], // Custom weekend - * weekendDays: 'auto' // Use locale detection (default) - * } - */ - const MIN_YEAR = 1900 const MAX_YEAR = 2100 -// Helper function to determine first day with config override support -function getConfiguredFirstDay() { - // Check for environment variable or global config - const configOverride = window?.calendarConfig?.firstDay - if (configOverride !== undefined) { - return configOverride === 'auto' ? getLocaleFirstDay() : Number(configOverride) - } - // Default to Monday (1) instead of locale - return 1 -} - -// Helper function to determine weekend days with config override support -function getConfiguredWeekendDays() { - // Check for environment variable or global config - const configOverride = window?.calendarConfig?.weekendDays - if (configOverride !== undefined) { - return configOverride === 'auto' ? getLocaleWeekendDays() : configOverride - } - // Default to locale-based weekend days - return getLocaleWeekendDays() -} - export const useCalendarStore = defineStore('calendar', { state: () => ({ today: toLocalString(new Date()), now: new Date(), events: new Map(), // Map of date strings to arrays of events - weekend: getConfiguredWeekendDays(), + weekend: getLocaleWeekendDays(), config: { select_days: 1000, min_year: MIN_YEAR, max_year: MAX_YEAR, - first_day: getConfiguredFirstDay(), + first_day: getLocaleFirstDay(), }, }),