hilongjw / vue-datepicker

[Deprecated] calendar and datepicker component with material design for Vue.js
http://hilongjw.github.io/vue-datepicker/demo.html
MIT License
702 stars 207 forks source link

Initial Time Not Formatted #47

Open sylvan-d-ash opened 8 years ago

sylvan-d-ash commented 8 years ago

I'm using this to display the D.O.B of a user and I'm getting the data from the database in 2016-08-22T12:39:29+0300 such a format. During the initial display, before interacting with the date picker, the date is displayed as above instead of 2016-08-22 (YYYY-MM-DD). This can be easily rectified by adding a coerce to the time property

time: { type: String, required: true, coerce(val) { if (val) { return _moment(val).format('YYYY-MM-DD') } return${val} }, }

I'll create a PR with this

hilongjw commented 8 years ago

Hi, @winter7621 ,welcome for pr