1234567891011121314151617181920212223242526272829303132333435363738 |
- /**
- * DO NOT EDIT THIS FILE.
- * See the following change record for more information,
- * https://www.drupal.org/node/2815083
- * @preserve
- **/
- (function ($, Modernizr, Drupal) {
- Drupal.behaviors.date = {
- attach: function attach(context, settings) {
- var $context = $(context);
- if (Modernizr.inputtypes.date === true) {
- return;
- }
- $context.find('input[data-drupal-date-format]').once('datePicker').each(function () {
- var $input = $(this);
- var datepickerSettings = {};
- var dateFormat = $input.data('drupalDateFormat');
- datepickerSettings.dateFormat = dateFormat.replace('Y', 'yy').replace('m', 'mm').replace('d', 'dd');
- if ($input.attr('min')) {
- datepickerSettings.minDate = $input.attr('min');
- }
- if ($input.attr('max')) {
- datepickerSettings.maxDate = $input.attr('max');
- }
- $input.datepicker(datepickerSettings);
- });
- },
- detach: function detach(context, settings, trigger) {
- if (trigger === 'unload') {
- $(context).find('input[data-drupal-date-format]').findOnce('datePicker').datepicker('destroy');
- }
- }
- };
- })(jQuery, Modernizr, Drupal);
|