Sha256: adfd7da0dd0ccc573f057d52a0278be8ca3ad235f1c68b4e6a365d184b78e449

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

((exports) => {
  const formDatePicker = () => {
    $('[data-datepicker]').each((_index, node) => {
      const language = $('html').attr('lang') || 'en';
      const initialDate = $(node).data('startdate') || '';
      const pickTime = $(node).data('timepicker') === '';
      const languageProps = $(node).fdatepicker.dates[language] && $(node).fdatepicker.dates[language].format;
      let format = languageProps || 'mm/dd/yyyy';

      if (pickTime) {
        format = `${format}, hh:ii`;
      }

      $(node).fdatepicker({
        format,
        initialDate,
        language,
        pickTime,
        disableDblClickSelection: true,
        leftArrow: '<<',
        rightArrow: '>>'
      }).on('changeDate', (ev) => {
        let newDate = "";
        if (ev.date !== null) {
          newDate = exports.moment.utc(ev.date).format('YYYY-MM-DDTHH:mm:ss');
        }
        $(ev.target).siblings('input').val(newDate);
      });
    });
  };

  exports.Decidim = exports.Decidim || {};
  exports.Decidim.formDatePicker = formDatePicker;
})(window);

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-core-0.10.1 vendor/assets/javascripts/form_datepicker.js.es6
decidim-core-0.10.0 vendor/assets/javascripts/form_datepicker.js.es6
decidim-core-0.9.3 vendor/assets/javascripts/form_datepicker.js.es6
decidim-core-0.9.2 vendor/assets/javascripts/form_datepicker.js.es6
decidim-core-0.9.1 vendor/assets/javascripts/form_datepicker.js.es6
decidim-core-0.9.0 vendor/assets/javascripts/form_datepicker.js.es6