datepicker icon indicating copy to clipboard operation
datepicker copied to clipboard

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

Open holic-cl opened this issue 7 years ago • 1 comments

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

holic-cl avatar Jun 27 '17 04:06 holic-cl

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.

havgry avatar Aug 06 '17 09:08 havgry