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

Error in render: "Error: missing 2nd parameter Months array"

Open fortifelx opened this issue 6 years ago • 5 comments

Hi! i'am use vue-cli and in main.js: import ru from 'vuejs-datepicker/dist/locale' than in index.html: and have error Property or method "ru" is not defined on the instance but referenced during render ... What i do wrong?

fortifelx avatar May 20 '18 09:05 fortifelx

Same Problem Here

willangelico avatar Jun 05 '18 13:06 willangelico

I use the pt-BR Language. I Solved this problem instaling the 0.9.24 version

npm install vuejs-datepicker@^0.9.24 --save

willangelico avatar Jun 05 '18 13:06 willangelico

So. I finally manage to (temporary) solve the issue... I used the component not as in documentation described but as in example shown The example is here https://codesandbox.io/s/mpklq49wp

Install it like : import Datepicker from "vuejs-datepicker/dist/vuejs-datepicker.esm.js"; import * as lang from "vuejs-datepicker/src/locale"; Not like: import Datepicker from 'vuejs-datepicker';

In data props added: language: "ru", // the language I need languages: lang, Add component <datepicker :language="languages[language]"></datepicker>

terean-dspd avatar Jun 24 '18 16:06 terean-dspd

This solution works for me


import Datepicker from 'vuejs-datepicker'
import {ru} from 'vuejs-datepicker/dist/locale'

export default {
//...
 data() {
    return {
      datepickerLang: ru,
//...
}

in HTML

<datepicker :language="datepickerLang">

sinau123 avatar Dec 11 '19 04:12 sinau123

So. I finally manage to (temporary) solve the issue... I used the component not as in documentation described but as in example shown The example is here https://codesandbox.io/s/mpklq49wp

Install it like : import Datepicker from "vuejs-datepicker/dist/vuejs-datepicker.esm.js"; import * as lang from "vuejs-datepicker/src/locale"; Not like: import Datepicker from 'vuejs-datepicker';

In data props added: language: "ru", // the language I need languages: lang, Add component <datepicker :language="languages[language]"></datepicker>

I can confirm that @terean-dspd's approach works as a solution. It might be worth closing this issue now (@charliekassel).

For anyone else facing this issue, I will include my code snippet used:

<template>
  <div>
    <vue-datepicker
      :language="languages[language]"
      :value="state.date"
    />
  </div>
</template>
<script>
import vueDatepicker from 'vuejs-datepicker';
import * as lang from 'vuejs-datepicker/src/locale';
import moment from 'moment';

export default {
    data() {
        return {
            language: 'en', //Input your language code here
            languages: lang,
            state: {
                date: moment.now()
            }
    }
}
</script>

Hope it might be of help for anyone else coming across this!

elementsuite-jake avatar Oct 18 '22 13:10 elementsuite-jake