charliekassel / vuejs-datepicker

A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations
MIT License
2.61k stars 730 forks source link

With from and to dates set the picker won't allow moving between years #38

Closed SamStenton closed 7 years ago

SamStenton commented 7 years ago

When setting the disabled 'to' and 'from' dates and making them years apart the picker wont allow switching between years in the fully zoomed out view.

vue-datepicker

Using Vue2

charliekassel commented 7 years ago

Can you confirm what the disabled dates are?

SamStenton commented 7 years ago

So I'm generating the disabled dates with:

    oldestChildCanBe() {
        var now = new Date()
        return new Date(now.setFullYear(now.getFullYear() - 16))
    },
    youngestChildCanBe() {
        var now = new Date()
        return new Date(now.setFullYear(now.getFullYear() - 5))
    } 

In the dev tools this looks like the following: screen shot 2016-11-19 at 14 34 16

Am I getting an issue because I've got the time in there too?

charliekassel commented 7 years ago

Ok, so this is expected behaviour. You can't navigate before or after the disabled dates. If you can't pick them why do you need to look at them?

SamStenton commented 7 years ago

I've disabled dates before 2000 and after 2011. In the initial view of the years I'm shown 2000 to 2009 but not 2010 and 2011. The only way I can get to those last two years is by going into the month view of 2009 and using the arrows at the top.

My issue is its not displaying the available years properly. Hope this is a better explanation.

charliekassel commented 7 years ago

Yes I see now. Not sure how many times I watched that gif... Looks like the decade page calculation for whether it should disable the next/previous pages was wrong. I've corrected now and released the patch - can you please take a look and see if it fixes?

SamStenton commented 7 years ago

Awesome that works now. Thank you.