diff --git a/.gitignore b/.gitignore index 33ddb919..0b0fffcb 100644 --- a/.gitignore +++ b/.gitignore @@ -106,4 +106,7 @@ typings/ .tern-port docs/.vitepress/cache -docs/.vitepress/dist \ No newline at end of file +docs/.vitepress/dist + +# ignore .DS_Store files +.DS_Store diff --git a/src/VueDatePicker/constants/defaults.ts b/src/VueDatePicker/constants/defaults.ts index 9e92c109..41725019 100644 --- a/src/VueDatePicker/constants/defaults.ts +++ b/src/VueDatePicker/constants/defaults.ts @@ -1,3 +1,4 @@ +import { WeekStart } from '.'; import { enUS } from 'date-fns/locale'; export const defaultRangeOptions = { @@ -148,7 +149,7 @@ export const basePropDefaults = { }; export const propDefaults = { - weekStart: 1, + weekStart: WeekStart.Monday, yearRange: (): [number, number] => [1900, 2100], ui: () => ({}), locale: () => enUS, diff --git a/src/VueDatePicker/constants/index.ts b/src/VueDatePicker/constants/index.ts index 0935328d..6558e273 100644 --- a/src/VueDatePicker/constants/index.ts +++ b/src/VueDatePicker/constants/index.ts @@ -53,3 +53,13 @@ export enum MAP_KEY_FORMAT { YEAR = 'yyyy', DATE = 'dd-MM-yyyy', } + +export enum WeekStart { + Sunday = 0, + Monday = 1, + Tuesday = 2, + Wednesday = 3, + Thursday = 4, + Friday = 5, + Saturday = 6, +} diff --git a/src/VueDatePicker/types/props.ts b/src/VueDatePicker/types/props.ts index 59baccf7..133ee66b 100644 --- a/src/VueDatePicker/types/props.ts +++ b/src/VueDatePicker/types/props.ts @@ -21,6 +21,7 @@ import type { import type { CalendarWeek, Marker, TimeModel, PresetDate, HighlightFn, DisabledTimesFn } from '@/types/picker.ts'; import type { PickerSection, DateValue, ModelValue, SixWeekMode } from '@/types/generic.ts'; import { basePropDefaults, type propDefaults } from '@/constants/defaults.ts'; +import type { WeekStart } from '@/constants'; export interface RootProps { multiCalendars?: boolean | number | string | Partial; @@ -53,7 +54,7 @@ export interface RootProps { teleport?: string | boolean | HTMLElement; centered?: boolean; locale?: Locale; - weekStart?: string | number; + weekStart?: string | number | WeekStart; weekNumbers?: boolean | WeekNumbersConfig; dayNames?: (() => string[]) | string[]; monthPicker?: boolean; diff --git a/src/index.ts b/src/index.ts index bba08601..434287c2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ export { default as VueDatePicker } from './VueDatePicker/VueDatePickerRoot.vue'; export { TZDate } from '@date-fns/tz'; export * from './VueDatePicker/types'; +export { WeekStart } from './VueDatePicker/constants';