Topic: Vue Datepicker Default Value and Reactiveness
joshg410 premium asked 5 years ago
I'm not seeing anything in the documentation for the default value of the mdbDatepicker component.
When the page loads, I want a pre-filled date of "01/01/2019", for example.
Also, doing :model="someDateFromPropsOrData" doesn't seem to be doing any two-way binding. It's not reactive. I've skirted around this by using the @getValue method and setting the date value each time it is changed. But this seems like an odd way to accomplish this, considering the basic bootstrap datepicker you can do v-model="myDate" and it's immediately reactive.
Here is a snippet of what I have (I would expect the :model="selectedToDate" part to populate with the selectedToDate's value, and also update it on change):
<mdb-date-picker
:model="selectedToDate"
@getValue="toDateChanged"
:option="toDatePickerOptions"
defaultDate="04/04/2019"
disableOk
disableClear
autoHide/>
Thanks,
-Josh
Magdalena Dembna staff answered 5 years ago
Hi, For now we do not provide the defaultDate prop. All props are listed in the API tab here: https://mdbootstrap.com/docs/vue/forms/date-picker/ . Regrettably, our component don't store the value - that's the reason why two way data binding doesn't work. It's likely that we'll focus on that issue in one of the future releases. Kind regards, Magdalena
joshg410 premium commented 5 years ago
Is there a way for me to subscribe to this so I know when the feature is ready? Thanks a lot for the reply. -Josh
Magdalena Dembna staff commented 5 years ago
Hi, The first feature - default date - is already on its way and should be available next week. As for the two way data binding, we're hoping to provide it as soon as possible. You can subscribe for our newsletter with updates here: https://mdbootstrap.com/docs/vue/newsletter/ . Kind regards, Magdalena
robshelby priority commented 4 years ago
Any updates on this feature?
Mikołaj Smoleński staff commented 4 years ago
In the latest DatePicker2 component there is a defaultDate property -> https://mdbootstrap.com/docs/vue/forms/date-picker/#docsTabsAPI
Best regards
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Premium
- Premium support: Yes
- Technology: MDB Vue
- MDB Version: 5.1.1
- Device: Macbook
- Browser: Chrome
- OS: macOS Mojave
- Provided sample code: No
- Provided link: No