nazar-pc / PickMeUp

Really simple, powerful, customizable and lightweight standalone datepicker
BSD Zero Clause License
615 stars 191 forks source link

'daysMin' is undefined #149

Closed yunshang closed 7 years ago

yunshang commented 7 years ago

This is my code

 <input class="date_start select-date"  name="q" id="q" placeholder="请选择查询日期区间">
<script>
  pickmeup('.date_start', {
    format: 'Y-m-d',
    default_date: false,
    mode: 'range',
    locale: {
      days: ['日', '一', '二', '三', '四', '五', '六', '天'],
      daysShort: ['日', '一', '二', '三', '四', '五', '六', '天'],
      daysMin: ['日', '一', '二', '三', '四', '五', '六', '天'],
      months: ['一月', ' 二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
    }
  });
</script>

I get this error ff

nazar-pc commented 7 years ago

locale key here should contain only language code. Translations themselves should be set on pickmeup.defaults.locales object.

For your example (if Google Translate correctly identifies language):

  pickmeup.defaults.locales['zh'] = {
      days: ['日', '一', '二', '三', '四', '五', '六', '天'],
      daysShort: ['日', '一', '二', '三', '四', '五', '六', '天'],
      daysMin: ['日', '一', '二', '三', '四', '五', '六', '天'],
      months: ['一月', ' 二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
    };
  pickmeup('.date_start', {
    format: 'Y-m-d',
    default_date: false,
    mode: 'range',
    locale: 'zh'
  });

It was like you've used initially in older versions of PickMeUp, but now PickMeUp supports multiple languages.

yunshang commented 7 years ago

thanks