@@ -51,7 +51,6 @@ interface VCalendarRenderProps {
51
51
end : CalendarTimestamp
52
52
component : JSXComponent & { filterProps : < T > ( props : T ) => Partial < T > }
53
53
maxDays : number
54
- weekdays : number [ ]
55
54
categories : CalendarCategory [ ]
56
55
}
57
56
@@ -154,12 +153,6 @@ export const VCalendar = genericComponent<new (
154
153
const lastStart = ref < CalendarTimestamp | null > ( null )
155
154
const lastEnd = ref < CalendarTimestamp | null > ( null )
156
155
157
- const parsedValue = computed ( ( ) : CalendarTimestamp => {
158
- return ( validateTimestamp ( props . modelValue )
159
- ? parseTimestamp ( props . modelValue , true )
160
- : ( base . parsedStart . value || base . times . today ) )
161
- } )
162
-
163
156
const parsedCategoryDays = computed ( ( ) : number => {
164
157
return parseInt ( String ( props . categoryDays ) ) || 1
165
158
} )
@@ -169,10 +162,9 @@ export const VCalendar = genericComponent<new (
169
162
} )
170
163
171
164
const renderProps = computed ( ( ) : VCalendarRenderProps => {
172
- const around = parsedValue . value
165
+ const around = base . parsedValue . value
173
166
let component : any = null
174
167
let maxDays = props . maxDays
175
- let weekdays = base . parsedWeekdays . value
176
168
let categories = parsedCategories . value
177
169
let start = around
178
170
let end = around
@@ -192,19 +184,12 @@ export const VCalendar = genericComponent<new (
192
184
case 'day' :
193
185
component = VCalendarDaily
194
186
maxDays = 1
195
- weekdays = [ start . weekday ]
196
187
break
197
188
case '4day' :
198
189
component = VCalendarDaily
199
190
end = relativeDays ( copyTimestamp ( end ) , nextDay , 3 )
200
191
updateFormatted ( end )
201
192
maxDays = 4
202
- weekdays = [
203
- start . weekday ,
204
- ( start . weekday + 1 ) % 7 ,
205
- ( start . weekday + 2 ) % 7 ,
206
- ( start . weekday + 3 ) % 7 ,
207
- ]
208
193
break
209
194
case 'custom-weekly' :
210
195
component = VCalendarWeekly
@@ -223,11 +208,6 @@ export const VCalendar = genericComponent<new (
223
208
end = relativeDays ( copyTimestamp ( end ) , nextDay , days )
224
209
updateFormatted ( end )
225
210
maxDays = days
226
- weekdays = [ ]
227
-
228
- for ( let i = 0 ; i < days ; i ++ ) {
229
- weekdays . push ( ( start . weekday + i ) % 7 )
230
- }
231
211
232
212
categories = getCategoryList ( categories )
233
213
break
@@ -236,11 +216,11 @@ export const VCalendar = genericComponent<new (
236
216
throw new Error ( `${ type } is not a valid Calendar type` )
237
217
}
238
218
239
- return { component, start, end, maxDays, weekdays , categories }
219
+ return { component, start, end, maxDays, categories }
240
220
} )
241
221
242
222
const eventWeekdays = computed ( ( ) : number [ ] => {
243
- return renderProps . value . weekdays
223
+ return base . effectiveWeekdays . value
244
224
} )
245
225
246
226
const categoryMode = computed ( ( ) : boolean => {
@@ -287,7 +267,7 @@ export const VCalendar = genericComponent<new (
287
267
}
288
268
289
269
function move ( amount = 1 ) : void {
290
- const moved = copyTimestamp ( parsedValue . value )
270
+ const moved = copyTimestamp ( base . parsedValue . value )
291
271
const forward = amount > 0
292
272
const mover = forward ? nextDay : prevDay
293
273
const limit = forward ? DAYS_IN_MONTH_MAX : DAY_MIN
@@ -402,7 +382,7 @@ export const VCalendar = genericComponent<new (
402
382
} )
403
383
404
384
useRender ( ( ) => {
405
- const { start, end, maxDays, component : Component , weekdays , categories } = renderProps . value
385
+ const { start, end, maxDays, component : Component , categories } = renderProps . value
406
386
return (
407
387
< Component
408
388
ref = { root }
@@ -413,7 +393,7 @@ export const VCalendar = genericComponent<new (
413
393
start = { start . date }
414
394
end = { end . date }
415
395
maxDays = { maxDays }
416
- weekdays = { weekdays }
396
+ weekdays = { base . effectiveWeekdays . value }
417
397
categories = { categories }
418
398
onClick :date = { ( e : MouseEvent , day : CalendarTimestamp ) => {
419
399
if ( attrs [ 'onUpdate:modelValue' ] ) emit ( 'update:modelValue' , day . date )
@@ -428,7 +408,6 @@ export const VCalendar = genericComponent<new (
428
408
...base ,
429
409
lastStart,
430
410
lastEnd,
431
- parsedValue,
432
411
parsedCategoryDays,
433
412
renderProps,
434
413
eventWeekdays,
0 commit comments