yuche / vue-strap

Bootstrap components built with Vue.js
http://yuche.github.io/vue-strap/
MIT License
4.72k stars 932 forks source link

Datepicker error when changing the date #128

Open fabdrol opened 8 years ago

fabdrol commented 8 years ago
<date-picker :value.sync="selectedDate" :format="'dd/mm/yyyy'"></date-picker>
<pre>{{ selectedDate }}</pre>

Datepicker initialises, but when you click a date in the popover it throws an error and a warning: Error: Uncaught TypeError: Cannot read property 'getMonth' of null Warning: [Vue warn]: Error when evaluating expression "{'datepicker-dateRange-item-active': (this.mouthNames[this.parse(this.value).getMonth()] === m) && this.currDate.getFullYear() === this.parse(this.value).getFullYear()}".

WarrenMT commented 8 years ago

Since you're alreading providing a string as the format, remove the ":" (colon) prefix from format, because it will try to evaluate 'dd/mm/yyyy', which is not valid JS. Just change :format="'dd/mm/yyyy'" to format="dd/mm/yyyy"