Skip to content

Commit c50f613

Browse files
committed
feat: Add internalModelValue to dayClass (resolves #872)
1 parent 023b947 commit c50f613

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ export interface VueDatePickerProps {
285285
teleportCenter?: boolean;
286286
teleport?: boolean | string | HTMLElement;
287287
ignoreTimeValidation?: boolean;
288-
dayClass?: (date: Date) => string;
288+
dayClass?: (date: Date, internalModelValue: InternalTime) => string;
289289
hideNavigation?: ('month' | 'year' | 'calendar' | 'time' | 'minutes' | 'hours' | 'seconds')[];
290290
/**
291291
* @deprecated

src/VueDatePicker/components/DatePicker/DpCalendar.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125

126126
<script lang="ts" setup>
127127
import { computed, nextTick, onMounted, ref } from 'vue';
128-
import { format, getISOWeek, getWeek } from 'date-fns';
128+
import { getISOWeek, getWeek } from 'date-fns';
129129
130130
import { checkKeyDown, checkStopPropagation, getDayNames, getDefaultMarker, unrefElement } from '@/utils/util';
131131
import { useArrowNavigation, useDefaults } from '@/composables';

src/VueDatePicker/composables/calendar-class.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export const useCalendarClass = (modelValue: WritableComputedRef<InternalModuleV
364364
return {
365365
...sharedClasses(day),
366366
...getModeClasses(day),
367-
[props.dayClass ? props.dayClass(day.value) : '']: true,
367+
[props.dayClass ? props.dayClass(day.value, props.internalModelValue) : '']: true,
368368
[props.calendarCellClassName]: !!props.calendarCellClassName,
369369
};
370370
};

src/VueDatePicker/props.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ export const AllProps = {
5656
disableMonthYearSelect: { type: Boolean as PropType<boolean>, default: false },
5757
disableYearSelect: { type: Boolean as PropType<boolean>, default: false },
5858
menuClassName: { type: String as PropType<string>, default: null },
59-
dayClass: { type: Function as PropType<(date: Date) => string>, default: null },
59+
dayClass: {
60+
type: Function as PropType<(date: Date, internalModelValue: InternalModuleValue) => string>,
61+
default: null,
62+
},
6063
yearRange: { type: Array as PropType<number[]>, default: () => [1900, 2100] },
6164
calendarCellClassName: { type: String as PropType<string>, default: null },
6265
enableTimePicker: { type: Boolean as PropType<boolean>, default: true },

0 commit comments

Comments
 (0)