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.

[SOLVED] Invalid prop: type check failed for prop "max". Expected String, Date, got Date

See original GitHub issue

Describe the bug

I follow steps on Form DatePicker docs for disabling days, but on :max and :min return an error on console:

[Vue warn]: Invalid prop: type check failed for prop “max”. Expected String, Date, got Date

My code

<template>
  <b-form-row class="form-wrapper">
      <b-form-datepicker
        :inline="true"
        :min="minDate"
        :max="maxDate"
        id="date-from"
        v-model="form.from"
        placeholder="Data"
        locale="pt-BR"
        :date-format-options="{
          year: 'numeric',
          month: '2-digit',
          day: '2-digit',
        }"
      />
      
      <b-form-datepicker
        :inline="true"
        id="date-to"
        :min="minDate"
        :max="maxDate"
        v-model="form.to"
        placeholder="Data"
        locale="pt-BR"
        :date-format-options="{
          year: 'numeric',
          month: '2-digit',
          day: '2-digit',
        }"
      />
  </b-form-row>
</template>

<script>
export default {
  data() {
    const now = new Date()
    const today = new Date(now.getFullYear(), now.getMonth(), now.getDate())

    const minDate = new Date(today)

    const maxDate = new Date(today)
    maxDate.setFullYear(maxDate.getFullYear() + 3)

    return {
      minDate,
      maxDate,
    }
  },
}
</script>

  • BootstrapVue: 2.17.3
  • Bootstrap: 4.5.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
travis5491811commented, Mar 3, 2021

The docs are wrong. Change :max="new Date()" to :max="new Date().toISOString()". They don’t show converting to iso string in docs example but it will throw error if you don’t.

0reactions
felipesuricommented, Mar 12, 2021

@travis5491811 Transform date in toISOString() solved my problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Vue warn]: Invalid prop: type check failed for prop "maxDate ...
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...
Read more >
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 >
[vue warn]: invalid prop: type check failed for prop - You.com
When the page is loaded server-side, these warnings appear in the server console: "[Vue warn]: Invalid prop: type check failed for prop "maxDate"....
Read more >
[Solved]-[Vue warn]: Invalid prop: type check failed for prop ...
Coding example for the question [Vue warn]: Invalid prop: type check failed for prop "productCartData". Expected Object, got String with value "[object ...
Read more >
type check failed for prop "value". Expected Date, got String ...
Vue DatePicker : Invalid prop: type check failed for prop "value". Expected Date, got String ... Hi All,. I am trying to use...
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