From d434a6f08c06a91a06055f9cfe7c64473cd5951f Mon Sep 17 00:00:00 2001 From: Efstathios Chouliaris Date: Mon, 17 Nov 2025 14:46:24 -0600 Subject: [PATCH 1/2] Default to Sunday as first day of the week and use enums --- .gitignore | 5 ++++- src/VueDatePicker/constants/defaults.ts | 3 ++- src/VueDatePicker/types/enums.ts | 9 +++++++++ src/VueDatePicker/types/index.ts | 1 + src/VueDatePicker/types/props.ts | 3 ++- 5 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 src/VueDatePicker/types/enums.ts 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..2a91d4c0 100644 --- a/src/VueDatePicker/constants/defaults.ts +++ b/src/VueDatePicker/constants/defaults.ts @@ -1,3 +1,4 @@ +import { WeekStart } from '@/types'; import { enUS } from 'date-fns/locale'; export const defaultRangeOptions = { @@ -148,7 +149,7 @@ export const basePropDefaults = { }; export const propDefaults = { - weekStart: 1, + weekStart: WeekStart.Sunday, yearRange: (): [number, number] => [1900, 2100], ui: () => ({}), locale: () => enUS, diff --git a/src/VueDatePicker/types/enums.ts b/src/VueDatePicker/types/enums.ts new file mode 100644 index 00000000..78819a95 --- /dev/null +++ b/src/VueDatePicker/types/enums.ts @@ -0,0 +1,9 @@ +export enum WeekStart { + Sunday = 0, + Monday = 1, + Tuesday = 2, + Wednesday = 3, + Thursday = 4, + Friday = 5, + Saturday = 6, +} diff --git a/src/VueDatePicker/types/index.ts b/src/VueDatePicker/types/index.ts index e7878018..0c7ae7c4 100644 --- a/src/VueDatePicker/types/index.ts +++ b/src/VueDatePicker/types/index.ts @@ -4,3 +4,4 @@ export * from './configs.ts'; export * from './generic.ts'; export * from './picker.ts'; export * from './emits.ts'; +export * from './enums.ts'; diff --git a/src/VueDatePicker/types/props.ts b/src/VueDatePicker/types/props.ts index 59baccf7..d2f1670b 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 '@/types/enums.ts'; 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; From c327432920239f5c3dbf784bfd704a30f789204b Mon Sep 17 00:00:00 2001 From: Efstathios Chouliaris Date: Tue, 18 Nov 2025 14:58:21 -0600 Subject: [PATCH 2/2] Address comments --- src/VueDatePicker/constants/defaults.ts | 4 ++-- src/VueDatePicker/constants/index.ts | 10 ++++++++++ src/VueDatePicker/types/enums.ts | 9 --------- src/VueDatePicker/types/index.ts | 1 - src/VueDatePicker/types/props.ts | 2 +- src/index.ts | 1 + 6 files changed, 14 insertions(+), 13 deletions(-) delete mode 100644 src/VueDatePicker/types/enums.ts diff --git a/src/VueDatePicker/constants/defaults.ts b/src/VueDatePicker/constants/defaults.ts index 2a91d4c0..41725019 100644 --- a/src/VueDatePicker/constants/defaults.ts +++ b/src/VueDatePicker/constants/defaults.ts @@ -1,4 +1,4 @@ -import { WeekStart } from '@/types'; +import { WeekStart } from '.'; import { enUS } from 'date-fns/locale'; export const defaultRangeOptions = { @@ -149,7 +149,7 @@ export const basePropDefaults = { }; export const propDefaults = { - weekStart: WeekStart.Sunday, + 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/enums.ts b/src/VueDatePicker/types/enums.ts deleted file mode 100644 index 78819a95..00000000 --- a/src/VueDatePicker/types/enums.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum WeekStart { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, -} diff --git a/src/VueDatePicker/types/index.ts b/src/VueDatePicker/types/index.ts index 0c7ae7c4..e7878018 100644 --- a/src/VueDatePicker/types/index.ts +++ b/src/VueDatePicker/types/index.ts @@ -4,4 +4,3 @@ export * from './configs.ts'; export * from './generic.ts'; export * from './picker.ts'; export * from './emits.ts'; -export * from './enums.ts'; diff --git a/src/VueDatePicker/types/props.ts b/src/VueDatePicker/types/props.ts index d2f1670b..133ee66b 100644 --- a/src/VueDatePicker/types/props.ts +++ b/src/VueDatePicker/types/props.ts @@ -21,7 +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 '@/types/enums.ts'; +import type { WeekStart } from '@/constants'; export interface RootProps { multiCalendars?: boolean | number | string | Partial; 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';