src/misc/datepickerComponent.js
function datePickerComponent(ngeoDatePickerTemplateUrl, $timeout) {
  return {
    scope: {
      onDateSelected: '&',
      time: '='
    },
    bindToController: true,
    controller: 'ngeoDatePickerController as datepickerCtrl',
    restrict: 'AE',
    templateUrl: ngeoDatePickerTemplateUrl,
    link: (scope, element, attrs, ctrl) => {
      if (!ctrl) {
        throw new Error('Missing ctrl');
      }
      ctrl.init();

      const lang = ctrl.gettextCatalog_.getCurrentLanguage();
      $.datepicker.setDefaults($.datepicker.regional[lang]);

      ctrl.sdateOptions = angular.extend({}, ctrl.sdateOptions, {
        'minDate': ctrl.initialMinDate,
        'maxDate': ctrl.initialMaxDate,
        'onClose': (selectedDate) => {
          if (selectedDate) {
            $(element[0]).find('input[name="edate"]').datepicker('option', 'minDate', selectedDate);
          }
        }
      });

      ctrl.edateOptions = angular.extend({}, ctrl.edateOptions, {
        'minDate': ctrl.initialMinDate,
        'maxDate': ctrl.initialMaxDate,
        'onClose': (selectedDate) => {
          if (selectedDate) {
            $(element[0]).find('input[name="sdate"]').datepicker('option', 'maxDate', selectedDate);
          }
        }
      });

      angular.element('body').on('hidden.bs.popover', () => {
        const dp = angular.element('#ui-datepicker-div');
        if (dp && dp.css('display') === 'block') {
          $(element[0]).find('input[name$="date"]').datepicker('hide');
        }
      });

      $timeout(() => {
        angular.element('#ui-datepicker-div').on('click', (e) => {
          e.stopPropagation();
        });
      });
    }
  };
}
function datePickerComponent(ngeoDatePickerTemplateUrl, $timeout) {
  return {
    scope: {
      onDateSelected: '&',
      time: '='
    },
    bindToController: true,
    controller: 'ngeoDatePickerController as datepickerCtrl',
    restrict: 'AE',
    templateUrl: ngeoDatePickerTemplateUrl,
    link: (scope, element, attrs, ctrl) => {
      if (!ctrl) {
        throw new Error('Missing ctrl');
      }
      ctrl.init();

      const lang = ctrl.gettextCatalog_.getCurrentLanguage();
      $.datepicker.setDefaults($.datepicker.regional[lang]);

      ctrl.sdateOptions = angular.extend({}, ctrl.sdateOptions, {
        'minDate': ctrl.initialMinDate,
        'maxDate': ctrl.initialMaxDate,
        'onClose': (selectedDate) => {
          if (selectedDate) {
            $(element[0]).find('input[name="edate"]').datepicker('option', 'minDate', selectedDate);
          }
        }
      });

      ctrl.edateOptions = angular.extend({}, ctrl.edateOptions, {
        'minDate': ctrl.initialMinDate,
        'maxDate': ctrl.initialMaxDate,
        'onClose': (selectedDate) => {
          if (selectedDate) {
            $(element[0]).find('input[name="sdate"]').datepicker('option', 'maxDate', selectedDate);
          }
        }
      });

      angular.element('body').on('hidden.bs.popover', () => {
        const dp = angular.element('#ui-datepicker-div');
        if (dp && dp.css('display') === 'block') {
          $(element[0]).find('input[name$="date"]').datepicker('hide');
        }
      });

      $timeout(() => {
        angular.element('#ui-datepicker-div').on('click', (e) => {
          e.stopPropagation();
        });
      });
    }
  };
}
function datePickerComponent ( ngeoDatePickerTemplateUrl , $timeout ) { return { scope : { onDateSelected : '&' , time : '=' } , bindToController : true , controller : 'ngeoDatePickerController as datepickerCtrl' , restrict : 'AE' , templateUrl : ngeoDatePickerTemplateUrl , link : ( scope , element , attrs , ctrl ) => { if ( ! ctrl ) { throw new Error ( 'Missing ctrl' ) ; } ctrl . init ( ) ; const lang = ctrl . gettextCatalog_ . getCurrentLanguage ( ) ; $ . datepicker . setDefaults ( $ . datepicker . regional [ lang ] ) ; ctrl . sdateOptions = angular . extend ( { } , ctrl . sdateOptions , { 'minDate' : ctrl . initialMinDate , 'maxDate' : ctrl . initialMaxDate , 'onClose' : ( selectedDate ) => { if ( selectedDate ) { $ ( element [ 0 ] ) . find ( 'input[name="edate"]' ) . datepicker ( 'option' , 'minDate' , selectedDate ) ; } } } ) ; ctrl . edateOptions = angular . extend ( { } , ctrl . edateOptions , { 'minDate' : ctrl . initialMinDate , 'maxDate' : ctrl . initialMaxDate , 'onClose' : ( selectedDate ) => { if ( selectedDate ) { $ ( element [ 0 ] ) . find ( 'input[name="sdate"]' ) . datepicker ( 'option' , 'maxDate' , selectedDate ) ; } } } ) ; angular . element ( 'body' ) . on ( 'hidden.bs.popover' , ( ) => { const dp = angular . element ( '#ui-datepicker-div' ) ; if ( dp && dp . css ( 'display' ) === 'block' ) { $ ( element [ 0 ] ) . find ( 'input[name$="date"]' ) . datepicker ( 'hide' ) ; } } ) ; $timeout ( ( ) => { angular . element ( '#ui-datepicker-div' ) . on ( 'click' , ( e ) => { e . stopPropagation ( ) ; } ) ; } ) ; } } ; }
Provide a directive to select a single date or a range of dates. Requires
jQuery UI for the 'datepicker' widget.

@param {string|function(!JQuery=, !angular.IAttributes=): string}
ngeoDatePickerTemplateUrl Template for the directive.
@param {angular.ITimeoutService} $timeout angular timeout service
@return {angular.IDirective} The directive specs.
@ngInject
@ngdoc directive
@ngname ngeoDatePicker
Provide a directive to select a single date or a range of dates . Requires jQuery UI for the datepicker widget .