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