vuejs-datepicker
vuejs-datepicker copied to clipboard
Invalid prop: type check failed for prop "openDate". Expected Date, got String.
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?
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'"
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.
seems like this solves the issue:
:open-date="new Date('01-01-2000')"
this will solve :
:openDate="new Date('30-06-2019')"
I still got the error, even after trying all of the suggestions above.
I still got the error, even after trying all of the suggestions above.
what error you are getting?
I still got the error, even after trying all of the suggestions above.
what error you are getting?
"Expected Date, got a String".
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')"
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.)
Tried all of the above suggestions, got nowhere.
:open-date="new Date(2000, 0, 1)"
Worked for me.
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 🙃