vuejs-datepicker icon indicating copy to clipboard operation
vuejs-datepicker copied to clipboard

Invalid prop: type check failed for prop "openDate". Expected Date, got String.

Open hoektoe opened this issue 6 years ago • 11 comments

Hello

Trying to upgrade from 0.9 to 1.5.1 . Keep running into the issue of setting the prop open-date. The documentation states it can take either Date or String. Yet I get the console log error " Invalid prop: type check failed for prop "openDate". Expected Date, got String."

Is the documentation outdated or does the string need to be very specific format?

hoektoe avatar Oct 15 '18 06:10 hoektoe

I have the same issue. The prop is working correctly but I'm still getting the same error. "Invalid prop: type check failed for prop "openDate". Expected Date, got String." My current example: :open-date="'01-01-2000'"

j7239 avatar Oct 24 '18 14:10 j7239

I get the same error with the following setting: open-date="01/01/2000". It seems to work relatively fine, the only problems are the error message + the calendar opens December 1999.

mortenkleveland avatar Oct 25 '18 07:10 mortenkleveland

seems like this solves the issue: :open-date="new Date('01-01-2000')"

piotrku avatar Nov 20 '18 20:11 piotrku

this will solve : :openDate="new Date('30-06-2019')"

incredibleasif avatar Jun 30 '19 10:06 incredibleasif

I still got the error, even after trying all of the suggestions above.

xaviarnl avatar Jul 11 '19 13:07 xaviarnl

I still got the error, even after trying all of the suggestions above.

what error you are getting?

incredibleasif avatar Jul 11 '19 17:07 incredibleasif

I still got the error, even after trying all of the suggestions above.

what error you are getting?

"Expected Date, got a String".

xaviarnl avatar Jul 11 '19 18:07 xaviarnl

I still got the error, even after trying all of the suggestions above.

what error you are getting?

"Expected Date, got a String".

You need to pass Date Object like this : :open-date="new Date('30-06-2019')"

incredibleasif avatar Jul 11 '19 18:07 incredibleasif

I still got the error, even after trying all of the suggestions above.

what error you are getting?

"Expected Date, got a String".

You need to pass Date Object like this : new Date('30-06-2019')

I know: that is what was suggested above by piotrku. But it doesn't work for me. (I even tried naming the input field "openDate" as in your example, but that didn't work either, but probably because the fieldname has to be kebab cased.)

xaviarnl avatar Jul 11 '19 18:07 xaviarnl

Tried all of the above suggestions, got nowhere.

:open-date="new Date(2000, 0, 1)"

Worked for me.

willans avatar Jan 29 '20 11:01 willans

Solving the problem itself is easy (with the new Date(...) solutions provided above)

The real problem I think is that the documentation clearly states that both String and Date are acceptable values when clearly that is not the case.

Anyways. I can see that the last comment (apart from my own) is 2 years old, so I guess this issue is a bit stale 🙃

irissiri7 avatar Dec 01 '22 14:12 irissiri7