wffranco / vue-strap

Bootstrap components built with Vue.js
http://wffranco.github.io/vue-strap/
MIT License
338 stars 132 forks source link

Lang on Datepicker #118

Open edwinnnss opened 7 years ago

edwinnnss commented 7 years ago

This is my lang config ->

id: {
    daysOfWeek: ['Mi', 'Se', 'Se', 'Ra', 'Ka', 'Ju', 'Sa'],
    limit: 'Mencapai limit (Maksimal {{limit}} item).',
    loading: 'Loading...',
    minLength: 'Panjang Minimal',
    months: [
        'Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni',
        'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'
    ],
    notSelected: 'Tidak ada yang dipilih',
    required: 'Dibutuhkan',
    search: 'Cari',
    selected: '{{count}} terpilih'
};

and my date format is dd MMM yyyy. When I click a date on datepicker on the 5th month, it's always return 5ei.
and if i click a date on 8th,10th,or 12th month, it's always set to new Date() when i reopened the datepicker component,

example ->

const date = new Date('20 Agu 2017');

return NaN, it's because of

parse (str) {
      if (str === undefined || str === null) { str = this.val }
      let date = str.length === 10 && (this.format === 'dd-MM-yyyy' || this.format === 'dd/MM/yyyy') ?
        new Date(str.substring(6, 10), str.substring(3, 5)-1, str.substring(0, 2)) :
        new Date(str)
      return isNaN(date.getFullYear()) ? new Date() : date
    },

I think need momentjs integration