Skip to content

Commit

Permalink
2.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Gillardo committed Apr 17, 2018
1 parent 3e65568 commit 067b269
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 39 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-ui-datetime-picker",
"version": "2.6.1",
"version": "2.6.2",
"homepage": "https://github.com/Gillardo/bootstrap-ui-datetime-picker",
"authors": [
"Gillardo <[email protected]>"
Expand Down
28 changes: 12 additions & 16 deletions datetime-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
$scope.disableFocusStealing = angular.isDefined($attrs.disableFocusStealing) ? $attrs.disableFocusStealing : uiDatetimePickerConfig.disableFocusStealing;

// check if an illegal combination of options exists
if ($scope.initialPicker == 'date' && !$scope.enableDate) {
if ($scope.initialPicker === 'date' && !$scope.enableDate) {
throw new Error("datetimePicker can't have initialPicker set to date and have enableDate set to false.");
}

Expand Down Expand Up @@ -177,13 +177,13 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
// add a solution to set time picker options min and max.
angular.forEach(['minDate', 'maxDate', 'initDate'], function (key) {
if ($scope.datepickerOptions[key]) {
if (key == 'minDate') {
if (key === 'minDate') {
if ($scope.timepickerOptions.min) {
timepickerEl.attr('min', 'timepickerOptions.min');
} else {
timepickerEl.attr('min', 'datepickerOptions.minDate');
}
} else if (key == 'maxDate') {
} else if (key === 'maxDate') {
if ($scope.timepickerOptions.max) {
timepickerEl.attr('max', 'timepickerOptions.max');
} else {
Expand Down Expand Up @@ -351,12 +351,12 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
// dt will not be undefined if the now or today button is pressed
if (dt && dt != null) {
// get the existing date and update the time
var date = new Date($scope.date);
date.setHours(dt.getHours());
date.setMinutes(dt.getMinutes());
date.setSeconds(dt.getSeconds());
date.setMilliseconds(dt.getMilliseconds());
dt = date;
var date1 = new Date($scope.date);
date1.setHours(dt.getHours());
date1.setMinutes(dt.getMinutes());
date1.setSeconds(dt.getSeconds());
date1.setMilliseconds(dt.getMilliseconds());
dt = date1;
}

// In case we have an invalid time, save the previous date part
Expand Down Expand Up @@ -394,7 +394,7 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo

if (closeOnDateSelection) {
// do not close when using timePicker as make impossible to choose a time
if ($scope.showPicker != 'time' && date != null) {
if ($scope.showPicker !== 'time' && date != null) {
// if time is enabled, swap to timePicker
if ($scope.enableTime) {
$scope.open('time');
Expand Down Expand Up @@ -513,7 +513,7 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo

// in order to update the timePicker, we need to update the model reference!
// as found here https://angular-ui.github.io/bootstrap/#/timepicker
if (picker == 'time') {
if (picker === 'time') {
$timeout(function () {
$scope.date = parseDateString(ngModel.$viewValue);
}, 50);
Expand Down Expand Up @@ -670,10 +670,8 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
function validateMinMax(value) {
if ($scope.datepickerOptions.minDate && value < $scope.datepickerOptions.minDate) {
return false;
} else if ($scope.datepickerOptions.maxDate && value > $scope.datepickerOptions.maxDate) {
return false;
} else {
return true;
return !($scope.datepickerOptions.maxDate && value > $scope.datepickerOptions.maxDate);
}
}

Expand Down Expand Up @@ -721,9 +719,7 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
}

var maskedValue = "";

var maskArray = dateFormat.split("");

var valueArray = value.split("");
var valueArrayIndex = 0;

Expand Down
32 changes: 14 additions & 18 deletions dist/datetime-picker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://github.com/Gillardo/bootstrap-ui-datetime-picker
// Version: 2.6.1
// Released: 2018-02-20
// Version: 2.6.2
// Released: 2018-04-17
angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.position'])
.constant('uiDatetimePickerConfig', {
dateFormat: 'yyyy-MM-dd HH:mm',
Expand Down Expand Up @@ -93,7 +93,7 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
$scope.disableFocusStealing = angular.isDefined($attrs.disableFocusStealing) ? $attrs.disableFocusStealing : uiDatetimePickerConfig.disableFocusStealing;

// check if an illegal combination of options exists
if ($scope.initialPicker == 'date' && !$scope.enableDate) {
if ($scope.initialPicker === 'date' && !$scope.enableDate) {
throw new Error("datetimePicker can't have initialPicker set to date and have enableDate set to false.");
}

Expand Down Expand Up @@ -180,13 +180,13 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
// add a solution to set time picker options min and max.
angular.forEach(['minDate', 'maxDate', 'initDate'], function (key) {
if ($scope.datepickerOptions[key]) {
if (key == 'minDate') {
if (key === 'minDate') {
if ($scope.timepickerOptions.min) {
timepickerEl.attr('min', 'timepickerOptions.min');
} else {
timepickerEl.attr('min', 'datepickerOptions.minDate');
}
} else if (key == 'maxDate') {
} else if (key === 'maxDate') {
if ($scope.timepickerOptions.max) {
timepickerEl.attr('max', 'timepickerOptions.max');
} else {
Expand Down Expand Up @@ -354,12 +354,12 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
// dt will not be undefined if the now or today button is pressed
if (dt && dt != null) {
// get the existing date and update the time
var date = new Date($scope.date);
date.setHours(dt.getHours());
date.setMinutes(dt.getMinutes());
date.setSeconds(dt.getSeconds());
date.setMilliseconds(dt.getMilliseconds());
dt = date;
var date1 = new Date($scope.date);
date1.setHours(dt.getHours());
date1.setMinutes(dt.getMinutes());
date1.setSeconds(dt.getSeconds());
date1.setMilliseconds(dt.getMilliseconds());
dt = date1;
}

// In case we have an invalid time, save the previous date part
Expand Down Expand Up @@ -397,7 +397,7 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo

if (closeOnDateSelection) {
// do not close when using timePicker as make impossible to choose a time
if ($scope.showPicker != 'time' && date != null) {
if ($scope.showPicker !== 'time' && date != null) {
// if time is enabled, swap to timePicker
if ($scope.enableTime) {
$scope.open('time');
Expand Down Expand Up @@ -516,7 +516,7 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo

// in order to update the timePicker, we need to update the model reference!
// as found here https://angular-ui.github.io/bootstrap/#/timepicker
if (picker == 'time') {
if (picker === 'time') {
$timeout(function () {
$scope.date = parseDateString(ngModel.$viewValue);
}, 50);
Expand Down Expand Up @@ -673,10 +673,8 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
function validateMinMax(value) {
if ($scope.datepickerOptions.minDate && value < $scope.datepickerOptions.minDate) {
return false;
} else if ($scope.datepickerOptions.maxDate && value > $scope.datepickerOptions.maxDate) {
return false;
} else {
return true;
return !($scope.datepickerOptions.maxDate && value > $scope.datepickerOptions.maxDate);
}
}

Expand Down Expand Up @@ -724,9 +722,7 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo
}

var maskedValue = "";

var maskArray = dateFormat.split("");

var valueArray = value.split("");
var valueArrayIndex = 0;

Expand Down
Loading

0 comments on commit 067b269

Please sign in to comment.