mengxiong10 / vue2-datepicker

A datepicker / datetimepicker component for Vue2
https://mengxiong10.github.io/vue2-datepicker/index.html
MIT License
1.52k stars 406 forks source link

[Bug] When disabled-date is specified, we can still select Year and Month #380

Open BaptisteLemarcis opened 4 years ago

BaptisteLemarcis commented 4 years ago

Vue2-datepicker version: 3.1.0 Vue version: 2.6.10 Browser: All

Steps to reproduce Add disabled date and click on the month or year button

Reproduction Link or Source Code https://jsfiddle.net/thd0b49w/

Expected behavior In the version 2 the month and year where disabled and not clickable

Actual behavior Even if every date in the month is disabled we can still click on it but cannot click on a day after that

mengxiong10 commented 4 years ago

Since the not-before and not-after are removed in v3.x. It will be difficult to determine if the year is disabled. Need to cycle every day of the year. I consider adding props to implement this feature or built-in this feature

iqbalme commented 4 years ago

what can we use to replace not-before function, I need that

mengxiong10 commented 4 years ago

@iqbalme disabled-date. https://mengxiong10.github.io/vue2-datepicker/index.html#DisabledDateTime

iqbalme commented 4 years ago

I want to disable date with multiple condition, let say i want to disable date before this month and after today? how can I do it?

mengxiong10 commented 4 years ago
    disabledDat(date) {

      return date < thisMonth || date > today;
    },
iqbalme commented 4 years ago

wow, it works, thank you so much

ohunayogege commented 4 years ago
    disabledDat(date) {

      return date < thisMonth || date > today;
    },

Where to add this please?

mengxiong10 commented 4 years ago

@ohunayogege :disable-date="disableDate"

ohunayogege commented 4 years ago

@ohunayogege :disable-date="disableDate"

Thanks. Solved it since...

But input-class is giving error. "-" is not allowed

BerciTheBeast commented 4 years ago

I would like to add to this: once can also manually enter a value as text input that falls into the disabled range.

Aristamo commented 4 years ago

I don't know, but I think it fits here. If you disable for example the weekends for the range selection. You can still select a wider range than the week. Would be nice to have some property to enable or disable the selection over disabled dates.