i was using the vue-date-picker for date picker functionality at an input fields because it matched 100% to my requirements. Problem is it working but on loading the page i am passing a default value from the database. but it is not showing me the value until i delete the v-model attribute.
And when i delete this attribute it did not update the date selecting from the datepicker calendar.
here is my code i am using in html
<input type="text" id="regular-date" class="form-control w-p100" placeholder="eg. 21 August, 2018" readonly @focus="showRegularDate = true">
<transition name="calendar-fade">
<date-picker color="#b173f8" :format="formatDate"
@close="showRegularDate = false"
v-if="showRegularDate"
v-model="regularDate"></date-picker>
</transition>
in script for the format i'm using
<script>
Vue.use(DatePicker)
Vue.config.lang = 'en';
new Vue({
el: '.app',
created: function () {
var today = new Date
this.minDateLimit = '' + today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate()
this.maxDateLimit = '' + today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + (today.getDate() + 7)
},
data: {
regularDate: '',
regularDate_2: '',
regularDate_3: '',
regularDate_4: '',
regularDate_5: '',
showRegularDate: false,
minDateLimit: '',
minDate: '',
showMinDate: false,
maxDateLimit: '',
maxDate: '',
showMaxDate: false,
rangeDate: '',
showRangeDate: false,
specifiedDate: '2016-4-19',
showSpecifiedDate: false,
formattedDate: '',
showFormattedDate: false
},
methods: {
formatDate(date) {
return moment(date).format('LLLL');
},
formatDate_2: function (date) {
return moment(date).format('LLLL');
},
formatDate_3: function (date) {
return moment(date).format('LLLL');
},
formatDate_4: function (date) {
return moment(date).format('LLLL');
},
formatDate_5: function (date) {
return moment(date).format('LLLL');
}
}
})
</script>
i am just using this vue for the datepicker. Is there some settings i should do or i'm missing something?.