Skip to content

Commit b077874

Browse files
authored
Merge pull request #1199 from ChronosMasterOfAllTime/main
Use Enums for WeekStart
2 parents 463a5d4 + c327432 commit b077874

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,7 @@ 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

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 '.';
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.Monday,
152153
yearRange: (): [number, number] => [1900, 2100],
153154
ui: () => ({}),
154155
locale: () => enUS,

src/VueDatePicker/constants/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,13 @@ export enum MAP_KEY_FORMAT {
5353
YEAR = 'yyyy',
5454
DATE = 'dd-MM-yyyy',
5555
}
56+
57+
export enum WeekStart {
58+
Sunday = 0,
59+
Monday = 1,
60+
Tuesday = 2,
61+
Wednesday = 3,
62+
Thursday = 4,
63+
Friday = 5,
64+
Saturday = 6,
65+
}

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 '@/constants';
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;

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export { default as VueDatePicker } from './VueDatePicker/VueDatePickerRoot.vue';
22
export { TZDate } from '@date-fns/tz';
33
export * from './VueDatePicker/types';
4+
export { WeekStart } from './VueDatePicker/constants';

0 commit comments

Comments
 (0)