vuelendar icon indicating copy to clipboard operation
vuelendar copied to clipboard

How to change the active month after initial selection?

Open vumaasha opened this issue 5 years ago • 6 comments

Setting default-date to a new value doesn't change the active month being displayed

Here is what I tried https://codesandbox.io/s/vuelendar-simple-day-selector-obfxe?fontsize=14&hidenavigation=1&theme=dark

vumaasha avatar Dec 03 '19 18:12 vumaasha

@vumaasha Hello, unfortunately it is not possible to change active month dynamically in current implementation. We use defaultDate in data stage, which is used only during component mount: https://github.com/codesthq/vuelendar/blob/master/components/vl-calendar.vue#L65-L71

Would you like to create pull request to change it ? Seems like watcher on defaultDate in vl-calendar would be a good idea to go.

lusarz avatar Dec 06 '19 12:12 lusarz

let me give it a try.

vumaasha avatar Dec 06 '19 16:12 vumaasha

@lusarz do we need a watcher? defaultDate is already in prop. we could move currentMonthMonth and currentMonthYear as computed fields. wouldn't that work?

vumaasha avatar Dec 07 '19 04:12 vumaasha

I have some concerns - currentMonthMonth and currentMonthYear is used by left/right navigation arrows.

lusarz avatar Dec 07 '19 11:12 lusarz

May be late to the party, but that's how i solved this issue, check this one

https://codesandbox.io/s/vuelendar-simple-day-selector-efez9?fontsize=14&hidenavigation=1&theme=dark

f24aalam avatar Feb 17 '20 07:02 f24aalam

Thank you @f24aalam - this solution looks nice.

lusarz avatar Feb 17 '20 07:02 lusarz