mengxiong10 / vue2-datepicker

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

[Feature request] Possible to set the day interval for range datepicker? #677

Closed lilyhoctint closed 2 years ago

lilyhoctint commented 2 years ago

What problem does this feature solve? For a reservation system, users are allowed to reserve an item for max 7 days. If this function is available, it's more convenient for user to select the correct day interval

What does the proposed API look like? When user dragged more than the max day interval, there should be no blue background effect on datpicker, and no click event on the date image

mengxiong10 commented 2 years ago

https://github.com/mengxiong10/vue2-datepicker/issues/430#issuecomment-648713825

lilyhoctint commented 2 years ago

working fine thanks for ur help I changed like this:

let dayInterval = 7; if (currentValues.length === 1) { return ( date < currentValues[0] || date > new Date(currentValues[0].getTime() + dayInterval 24 3600 * 1000) ); }