litepie-datepicker
litepie-datepicker copied to clipboard
Enabling only a few dates
Hello! I'm creating a checkin and checkout calendar, however, I only see you are able to disable specific dates. Using the function callback on :disable-date would not work, because the disabled dates would rely on other component data, and the function would not rerun whenever that data changes. Using a computed property would require me to return an array of ALL dates except available checkin dates.
Is there a similar :disable-date but instead for :enable-date? That way I could only have a computed property returning an array of available checkin and checkout dates, disabling all other dates.
Thanks for help!
check it here if you want disable date but enable for selected range.
@kenhyuwa Hello! I'm not exactly sure that solves my issue. Could be I am misunderstanding, but I want to enable certain checkin dates, and when the checkin date has been selected, enable available checkout dates for that checkin date.
With :enable-date computed property, I could just control with an array what sort of dates should be enabled in the calendar :), and base that on what checkin date they selected.
Or maybe i could solve this with :disable-in-range="false", if so, how?
I am not certain I understand the :disable-in-range prop exactly right.
@ExpDev07 sorry I don't understand your problem, you want to disable all dates before selecting checkin date and enable if checkin date has been selected?
@kenhyuwa I want to disable all dates except the checkin dates that are available, then when a checkin date has been selected, I want to disable all dates except the available checkout dates :)
@ExpDev07 your case not general,
you can use computed property for parse and compare props :disable-date.
computed:{
disableDate(){
// logic for compare date
}
}
@kenhyuwa thanks for reply. I know it's not general, but it's not the most specific case either. If people want to use this calendar to make booking calendars, this feature is a must have pretty much.
Computed property would work, but it doesn't take any parameters, so I would be forced to return an array of ALL dates except available checkin dates. This doesn't sound promising for performance.
I would potentially have to move over to flatpickr to code this functionality.
Thank you for suggestion, i mean you see this reference for this issues. I think this advance feature.
Thank you for suggestion, i mean you see this reference for this issues.
I think this advance feature.
Yes, exactly ! Being able to pass an array of dates that should be enabled would solve issue for me. Essentially reverse :disable-date. Is this easy to add? Would you accept a PR for it?
yeah, please submit your pull request. thank you...