vue-bulma / datepicker

Datepicker Component for Vue Bulma
MIT License
115 stars 56 forks source link

[Vue warn]: Invalid prop: type check failed for prop "value". Expected String, got Date. #58

Open holic-cl opened 7 years ago

holic-cl commented 7 years ago

Hi, i tried to give a computed property to the datepicker but is not accepting instances of Date or numbers (timestamps) and i need to give the hour to my datepicker.

I got:

[Vue warn]: Invalid prop: type check failed for prop "value". Expected String, got Date

As flatpickr documentation say it can specify date as Date, timestamps and strings.

To give it a default time when the module has just mounted i give the date value as ISO Date string format as workaround to set the clock on last edited value.

I don't know if i am doing something wrong or this feature is not supported yet.

Regards

havgry commented 7 years ago

I agree. Passing a Date object or a Unix timestamp works perfectly well and is probably preferable as it doesn't rely on string parsing. Keep in mind that currently a string is always returned so you'll have to deal with multiple types.

flatpickr returns an array of Date objects. I prefer this approach as it takes date parsing out of the equation (granted you supply a Date object in the first place). It's pretty straightforward to make the change but it would be a breaking change - I still think it should be done, though.