Fix: Calendar view not updating when selectedDate changes - vue-cal v5 sync issue #81
GerardoIbarra
started this conversation in
General
Replies: 2 comments
-
Documentation inconsistency: date-picker example does not match actual usage I noticed that the documentation example for syncing 📄 Documentation shows: vue-cal(
date-picker
:views-bar="false"
v-model:selected-date="exSyncTwoCalendars.selectedDate"
@update:selected-date="exSyncTwoCalendars.viewDate = $event"
:view-date="exSyncTwoCalendars.viewDate"
:dark="store.darkMode")
However, in the code the correct implementation looks like this:
<vue-cal
v-model:view-date="exSyncTwoCalendars.viewDate"
v-model:selected-date="exSyncTwoCalendars.selectedDate"
:views="['day', 'week']"
:views-bar="false"
:dark="store.darkMode"
/>
This makes it confusing for new users since the docs suggest a different approach that doesn’t work properly. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Additionally, I tested this with a different date picker (PrimeVue <DatePicker
v-model="exSyncTwoCalendars.selectedDate"
@update:modelValue="exSyncTwoCalendars.viewDate = $event"
/>
<vue-cal
v-model:view-date="exSyncTwoCalendars.viewDate"
v-model:selected-date="exSyncTwoCalendars.selectedDate"
...
/>
So if anyone prefers to use another date picker instead of the built-in one, this approach works without problems.
The only change I needed to make to get everything working (both with `vue-cal`'s built-in date-picker and with PrimeVue's `DatePicker`) was to declare the state like this:
```js
const exSyncTwoCalendars = reactive({
selectedDate: null,
viewDate: null,
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
When changing the date in the DatePicker, the
selectedDate
updates in the store but the vue-cal calendar view doesn't automatically switch to show the week containing the new date.Current Implementation
v-model:selected-date="selectedDate"
as per vue-cal v4 documentationselectedDate
in the storeExpected Behavior
According to vue-cal v5 docs (@https://antoniandre.github.io/vue-cal/examples/dom-events#ex--sync-two-calendars), using
v-model:selected-date
should automatically sync the calendar view.Steps to Reproduce
selectedDate
changes in store##Code Example:
Store:
Componenet:
Component two :
##Current vs Expected Behavior
Current: selectedDate changes, events are fetched, but calendar view doesn't move
Expected: selectedDate changes, calendar automatically moves to show the week containing that date
Environment
Beta Was this translation helpful? Give feedback.
All reactions