Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Script setup> impossible to switch between dates #391

Open
JohnyDyxt opened this issue Jul 11, 2022 · 5 comments
Open

<Script setup> impossible to switch between dates #391

JohnyDyxt opened this issue Jul 11, 2022 · 5 comments

Comments

@JohnyDyxt
Copy link

Hello team,

I can't reproduce it on codepen so i will try to be as clear as possible.

I'm under Vue 3.2 with composition api <script setup>.
The problem is that it's absolutely impossible to switch between date (prev, today and next).

When i click on a button, i see in the console that something happen but nothing really happen on the calendar.

Below my code :

<script setup> import { ref } from 'vue' import { QCalendarDay, today } from '@quasar/quasar-ui-qcalendar' const selectedDate = today() const calendar = ref(null) const onToday = () => { calendar.value.moveToToday } const onPrev = () => { calendar.value.prev } const onNext = () => { calendar.value.next } </script>

code
console

@Bruno17
Copy link

Bruno17 commented Jul 12, 2022

Doesn't it has to be

calendar.value.prev()

same with next() and moveToToday() ?

@JohnyDyxt
Copy link
Author

Hi and thank you for your answer,

If i add () at the end, the behavior is exactly the same. Nothing happened.
If i console.log it , the console will display UNDEFINED.

If i console.log(calendar.value.prev) => I see the function but nothing happened.

@adgower
Copy link

adgower commented Sep 5, 2022

I have the same issue. Nothing happens.

      <q-calendar-month animated transition-next="flip-left" ref="calendar" :weekdays="[1, 2, 3, 4, 5]">
const calendar = ref(null);

const onNext = () => {
  calendar.value.next();
};

@adgower
Copy link

adgower commented Sep 5, 2022

I believe I found the solution, and I may have missed it in the documentation, but in order for the prev/next to work you need to set a v-model for the calendar with a date selected:

v-model="selectedDate"

import { today } from "@quasar/quasar-ui-qcalendar/src/index.js"

const selectedDate = ref(today())

You don't need to import today, but you need to set selectedDate as a valid formatted date according to docs, and then the prev next works.

@aasen
Copy link

aasen commented Apr 27, 2024

Shouldn't this issue be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants