src/misc/datepickerComponent.js
function Controller($scope, ngeoTime, gettextCatalog) {

  /**
   * @type {import("ngeo/misc/Time.js").Time}
   * @private
   */
  this.ngeoTime_ = ngeoTime;

  /**
   * @type {?import('ngeo/datasource/OGC.js').TimeProperty}
   */
  this.time = null;

  /**
   * The gettext catalog
   * @type {!angular.gettext.gettextCatalog}
   * @private
   */
  this.gettextCatalog_ = gettextCatalog;


  /**
   * If the component is used to select a date range
   * @type {boolean}
   */
  this.isModeRange = false;


  /**
   * Function called after date(s) changed/selected
   * @type {?function({time: {start: number, end: ?number}}): void}
   */
  this.onDateSelected = null;


  /**
   * Initial min date for the datepicker
   * @type {?Date}
   */
  this.initialMinDate = null;

  /**
   * Initial max date for the datepickeronDateSelected
   * @type {?Date}
   */
  this.initialMaxDate = null;

  /**
   * Datepicker options for the second datepicker (only for range mode)
   * @type {Object}
   */
  this.edateOptions = {
    'changeMonth': true,
    'changeYear': true
  };

  /**
   * Datepicker options for the first datepicker
   * @type {Object}
   */
  this.sdateOptions = {
    'changeMonth': true,
    'changeYear': true
  };

  /**
   * Start date model for the first date picker
   * @type {?Date}
   */
  this.sdate = null;

  /**
   * End date model for the second datepicker (only for range mode)
   * @type {?Date}
   */
  this.edate = null;

  $scope.$watchGroup(['datepickerCtrl.sdate', 'datepickerCtrl.edate'], (newDates, oldDates) => {
    if (!this.onDateSelected) {
      throw new Error('Missing onDateSelected');
    }
    const sDate = newDates[0];
    const eDate = newDates[1];

    if (angular.isDate(sDate) && (!this.isModeRange || angular.isDate(eDate))) {
      const start = this.ngeoTime_.getTime(sDate);
      const end = this.ngeoTime_.getTime(eDate);
      if (!start) {
        throw new Error('Missing start');
      }
      this.onDateSelected({
        time: {
          start,
          end,
        }
      });
    }
  });
}
function Controller($scope, ngeoTime, gettextCatalog) {

  /**
   * @type {import("ngeo/misc/Time.js").Time}
   * @private
   */
  this.ngeoTime_ = ngeoTime;

  /**
   * @type {?import('ngeo/datasource/OGC.js').TimeProperty}
   */
  this.time = null;

  /**
   * The gettext catalog
   * @type {!angular.gettext.gettextCatalog}
   * @private
   */
  this.gettextCatalog_ = gettextCatalog;


  /**
   * If the component is used to select a date range
   * @type {boolean}
   */
  this.isModeRange = false;


  /**
   * Function called after date(s) changed/selected
   * @type {?function({time: {start: number, end: ?number}}): void}
   */
  this.onDateSelected = null;


  /**
   * Initial min date for the datepicker
   * @type {?Date}
   */
  this.initialMinDate = null;

  /**
   * Initial max date for the datepickeronDateSelected
   * @type {?Date}
   */
  this.initialMaxDate = null;

  /**
   * Datepicker options for the second datepicker (only for range mode)
   * @type {Object}
   */
  this.edateOptions = {
    'changeMonth': true,
    'changeYear': true
  };

  /**
   * Datepicker options for the first datepicker
   * @type {Object}
   */
  this.sdateOptions = {
    'changeMonth': true,
    'changeYear': true
  };

  /**
   * Start date model for the first date picker
   * @type {?Date}
   */
  this.sdate = null;

  /**
   * End date model for the second datepicker (only for range mode)
   * @type {?Date}
   */
  this.edate = null;

  $scope.$watchGroup(['datepickerCtrl.sdate', 'datepickerCtrl.edate'], (newDates, oldDates) => {
    if (!this.onDateSelected) {
      throw new Error('Missing onDateSelected');
    }
    const sDate = newDates[0];
    const eDate = newDates[1];

    if (angular.isDate(sDate) && (!this.isModeRange || angular.isDate(eDate))) {
      const start = this.ngeoTime_.getTime(sDate);
      const end = this.ngeoTime_.getTime(eDate);
      if (!start) {
        throw new Error('Missing start');
      }
      this.onDateSelected({
        time: {
          start,
          end,
        }
      });
    }
  });
}
function Controller ( $scope , ngeoTime , gettextCatalog ) { /**
   * @type {import("ngeo/misc/Time.js").Time}
   * @private
   */ this . ngeoTime_ = ngeoTime ; /**
   * @type {?import('ngeo/datasource/OGC.js').TimeProperty}
   */ this . time = null ; /**
   * The gettext catalog
   * @type {!angular.gettext.gettextCatalog}
   * @private
   */ this . gettextCatalog_ = gettextCatalog ; /**
   * If the component is used to select a date range
   * @type {boolean}
   */ this . isModeRange = false ; /**
   * Function called after date(s) changed/selected
   * @type {?function({time: {start: number, end: ?number}}): void}
   */ this . onDateSelected = null ; /**
   * Initial min date for the datepicker
   * @type {?Date}
   */ this . initialMinDate = null ; /**
   * Initial max date for the datepickeronDateSelected
   * @type {?Date}
   */ this . initialMaxDate = null ; /**
   * Datepicker options for the second datepicker (only for range mode)
   * @type {Object}
   */ this . edateOptions = { 'changeMonth' : true , 'changeYear' : true } ; /**
   * Datepicker options for the first datepicker
   * @type {Object}
   */ this . sdateOptions = { 'changeMonth' : true , 'changeYear' : true } ; /**
   * Start date model for the first date picker
   * @type {?Date}
   */ this . sdate = null ; /**
   * End date model for the second datepicker (only for range mode)
   * @type {?Date}
   */ this . edate = null ; $scope . $watchGroup ( [ 'datepickerCtrl.sdate' , 'datepickerCtrl.edate' ] , ( newDates , oldDates ) => { if ( ! this . onDateSelected ) { throw new Error ( 'Missing onDateSelected' ) ; } const sDate = newDates [ 0 ] ; const eDate = newDates [ 1 ] ; if ( angular . isDate ( sDate ) && ( ! this . isModeRange || angular . isDate ( eDate ) ) ) { const start = this . ngeoTime_ . getTime ( sDate ) ; const end = this . ngeoTime_ . getTime ( eDate ) ; if ( ! start ) { throw new Error ( 'Missing start' ) ; } this . onDateSelected ( { time : { start , end , } } ) ; } } ) ; }
DatePickerController - directive conttroller
@param {!angular.IScope} $scope Angular scope.
@param {!import("ngeo/misc/Time.js").Time} ngeoTime time service.
@param {!angular.gettext.gettextCatalog} gettextCatalog service.
@constructor
@private
@hidden
@ngInject
@ngdoc controller
@ngname ngeoDatePickerController
DatePickerController - directive conttroller