Topic: set available dates for mdbDatePicker
Hi, I have a datetime picker on my page I want to set available dates for every 5 days from specific date for ex:
- 27-11-2019
- 22-11-2019
- 17-11-2019
other dates will be disabled or not cannot be selected .
How can I achieve that ?
Thank you,
Mikołaj Smoleński staff answered 5 years ago
Mikołaj Smoleński staff answered 5 years ago
Hi there,
You can adjust the limits option, which is described here at the bottom of the page: https://mdbootstrap.com/docs/vue/forms/date-picker/
Here's an example code:
<script>
import { mdbDatePicker } from 'mdbvue';
export default {
name: 'Example',
components: {
mdbDatePicker
},
data() {
return {
limit: [{
type: 'weekday',
available: [1, 2, 3, 4, 5]
},
{
type: 'fromto',
from: '2018-02-01',
to: '2018-06-20'
}]
};
}
}
</script>
Best regards
ozgehan pro premium answered 5 years ago
Hi Mikolaj,
The way you suggest works if I have static dates but I don't know if the day will be weekday or weekend. such as today is 09.12.2019 and it is a week day but when you go back every 5 days you will get 04.12.2019->29.11.2019->24.11.2019
the date 24.11.2019 is a weekend day. so the example you suggested cannot be used in this case. what ı need is customized limit options or smt like that.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB Vue
- MDB Version: 6.0.0
- Device: computer
- Browser: chrome
- OS: windows
- Provided sample code: No
- Provided link: No