question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Hello,

I am using Nuxt-Buefy (latest version) with the latest version of Nuxt (2.4.5). When I use the datepicker component and put a v-model, min-date or max-date, I have a persistent warning when the page is loaded server-side:

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

Reproducer

yarn create nuxt-app testnuxt (choose Universal)
yarn add nuxt-buefy
Add 'nuxt-buefy' module in the nuxt.config.js 
Add <b-datepicker :max-date="new Date()" /> in the index.vue 

When the page is loaded server-side, these warnings appear in the server console: "[Vue warn]: Invalid prop: type check failed for prop “maxDate”. Expected Date, got Date " When the page is loaded client-side, there is no problem.

Nuxt version

I tested it with Nuxt 2.3.4, I had no warning and no issue. The problem exists since Nuxt version 2.4.

When I switched to version 2.4, I also had this issue which I think is the same: https://github.com/davestewart/vuex-pathify/pull/46 (in both cases it’s the “instanceof” method that isn’t working anymore since Nuxt 2.4)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:11
  • Comments:19

github_iconTop GitHub Comments

7reactions
DonNicoJscommented, May 2, 2019

@ilbonte @davegriffin @SebastienTainon So I investigated this issue with the help of manniL from the nuxt team.

The warning is present only in DEV and never in production, and is because of this feature: https://github.com/nuxt/nuxt.js/pull/4508

TLDR: in dev mode some components are built in parallel so the date instance is different and so instanceof fails.

6reactions
davegriffincommented, May 1, 2019

We’ve also seen a similar issue with a Nuxt.js project: wrapping the b-datepicker / b-timepicker component references in <no-ssr> </no-ssr> tags resolved the issue. (As noted, the pickers were working fine on the client, just throwing errors in the server log.)

Just an FYI for anyone looking for a workaround and a cleaner log file. (thanks to @jtommy for the hint that the issue was reported here)

Read more comments on GitHub >

github_iconTop Results From Across the Web

type check failed for prop. Expected Date, got Number with ...
This returns the following two errors: Invalid prop: type check failed for prop "firstDate". Expected Date, got Number with value -2019. and.
Read more >
type check failed for prop "value". Expected Date, got String ...
Hi All,. I am trying to use vuejs-datepicker for getting input date from user. But I am always getting the below error when...
Read more >
type check failed for prop "items". expected array, got string ...
Vue.js throws multiple warnings: Invalid prop: type check failed for prop "items". Expected Array, got String with value "".
Read more >
type check failed for prop "data". Expected Object, got Array
I'm using laravel-vue-pagination getting this error Invalid prop: type check failed for prop "data". Expected Object, got Array code is.
Read more >
[Solved]-[Vue warn]: Invalid prop: type check failed for prop ...
[Solved]-[Vue warn]: Invalid prop: type check failed for prop "productCartData". Expected Object, got String with value "[object Object]"-Vue.js.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found