Skip to content

Commit

Permalink
Merge pull request #3790 from camptocamp/f_3419
Browse files Browse the repository at this point in the history
Fix the minDate and maxDate initialization in the datepicker option object
  • Loading branch information
sbrunner committed Apr 23, 2018
2 parents 77bc95d + 6540b2f commit bafa6f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/directives/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ ngeo.DatePicker = function(ngeoDatePickerTemplateUrl, $timeout) {
$['datepicker']['setDefaults']($['datepicker']['regional'][lang]);

ctrl.sdateOptions = angular.extend({}, ctrl.sdateOptions, {
'minDate': ctrl.initialMinDate,
'maxDate': ctrl.initialMaxDate,
'onClose': function(selectedDate) {
if (selectedDate) {
$(element[0]).find('input[name="edate"]').datepicker('option', 'minDate', selectedDate);
Expand All @@ -54,6 +56,8 @@ ngeo.DatePicker = function(ngeoDatePickerTemplateUrl, $timeout) {
});

ctrl.edateOptions = angular.extend({}, ctrl.edateOptions, {
'minDate': ctrl.initialMinDate,
'maxDate': ctrl.initialMaxDate,
'onClose': function(selectedDate) {
if (selectedDate) {
$(element[0]).find('input[name="sdate"]').datepicker('option', 'maxDate', selectedDate);
Expand Down Expand Up @@ -149,8 +153,6 @@ ngeo.DatePickerController = function($scope, $injector, ngeoTime, gettextCatalog
* @export
*/
this.edateOptions = {
'minDate': this.initialMinDate,
'maxDate': this.initialMaxDate,
'changeMonth': true,
'changeYear': true
};
Expand All @@ -161,8 +163,6 @@ ngeo.DatePickerController = function($scope, $injector, ngeoTime, gettextCatalog
* @export
*/
this.sdateOptions = {
'minDate': this.initialMinDate,
'maxDate': this.initialMaxDate,
'changeMonth': true,
'changeYear': true
};
Expand Down
2 changes: 1 addition & 1 deletion src/directives/partials/datepicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div ng-if="::datepickerCtrl.time.widget === 'datepicker'">
<div class="ngeo-datepicker-start-date">
<span ng-if="::datepickerCtrl.time.mode === 'range'" translate>From:</span>
<span ng-if="::datepickerCtrl.time.mode !== 'range'"translate>Date:</span>
<span ng-if="::datepickerCtrl.time.mode !== 'range'" translate>Date:</span>
<input name="sdate" ui-date="datepickerCtrl.sdateOptions" ng-model="datepickerCtrl.sdate" required=""/>
</div>
<div
Expand Down

0 comments on commit bafa6f8

Please sign in to comment.