Skip to content

Commit 5c31ac3

Browse files
Default to Sunday as first day of the week and use enums
1 parent 463a5d4 commit 5c31ac3

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,9 @@ typings/
106106
.tern-port
107107

108108
docs/.vitepress/cache
109-
docs/.vitepress/dist
109+
docs/.vitepress/dist
110+
111+
# ignore .DS_Store files
112+
.DS_Store
113+
114+
# Snyk Security Extension - AI Rules (auto-generated)

src/VueDatePicker/constants/defaults.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { WeekStart } from '@/types';
12
import { enUS } from 'date-fns/locale';
23

34
export const defaultRangeOptions = {
@@ -148,7 +149,7 @@ export const basePropDefaults = {
148149
};
149150

150151
export const propDefaults = {
151-
weekStart: 1,
152+
weekStart: WeekStart.Sunday,
152153
yearRange: (): [number, number] => [1900, 2100],
153154
ui: () => ({}),
154155
locale: () => enUS,

src/VueDatePicker/types/enums.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export enum WeekStart {
2+
Sunday = 0,
3+
Monday = 1,
4+
Tuesday = 2,
5+
Wednesday = 3,
6+
Thursday = 4,
7+
Friday = 5,
8+
Saturday = 6,
9+
}

src/VueDatePicker/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ export * from './configs.ts';
44
export * from './generic.ts';
55
export * from './picker.ts';
66
export * from './emits.ts';
7+
export * from './enums.ts';

src/VueDatePicker/types/props.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import type {
2121
import type { CalendarWeek, Marker, TimeModel, PresetDate, HighlightFn, DisabledTimesFn } from '@/types/picker.ts';
2222
import type { PickerSection, DateValue, ModelValue, SixWeekMode } from '@/types/generic.ts';
2323
import { basePropDefaults, type propDefaults } from '@/constants/defaults.ts';
24+
import type { WeekStart } from '@/types/enums.ts';
2425

2526
export interface RootProps {
2627
multiCalendars?: boolean | number | string | Partial<MultiCalendarsConfig>;
@@ -53,7 +54,7 @@ export interface RootProps {
5354
teleport?: string | boolean | HTMLElement;
5455
centered?: boolean;
5556
locale?: Locale;
56-
weekStart?: string | number;
57+
weekStart?: string | number | WeekStart;
5758
weekNumbers?: boolean | WeekNumbersConfig;
5859
dayNames?: (() => string[]) | string[];
5960
monthPicker?: boolean;

0 commit comments

Comments
 (0)