Skip to content

Commit

Permalink
chore(timepicker): clean up code style
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleycho committed Aug 13, 2015
1 parent fba7bfb commit 0e32664
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/timepicker/timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ angular.module('ui.bootstrap.timepicker', [])
ngModelCtrl = { $setViewValue: angular.noop }, // nullModelCtrl
meridians = angular.isDefined($attrs.meridians) ? $scope.$parent.$eval($attrs.meridians) : timepickerConfig.meridians || $locale.DATETIME_FORMATS.AMPMS;

this.init = function( ngModelCtrl_, inputs ) {
this.init = function(ngModelCtrl_, inputs) {
ngModelCtrl = ngModelCtrl_;
ngModelCtrl.$render = this.render;

ngModelCtrl.$formatters.unshift(function(modelValue) {
return modelValue ? new Date( modelValue ) : null;
return modelValue ? new Date(modelValue) : null;
});

var hoursInputEl = inputs.eq(0),
minutesInputEl = inputs.eq(1);

var mousewheel = angular.isDefined($attrs.mousewheel) ? $scope.$parent.$eval($attrs.mousewheel) : timepickerConfig.mousewheel;
if ( mousewheel ) {
this.setupMousewheelEvents( hoursInputEl, minutesInputEl );
if (mousewheel) {
this.setupMousewheelEvents(hoursInputEl, minutesInputEl);
}

var arrowkeys = angular.isDefined($attrs.arrowkeys) ? $scope.$parent.$eval($attrs.arrowkeys) : timepickerConfig.arrowkeys;
if (arrowkeys) {
this.setupArrowkeyEvents( hoursInputEl, minutesInputEl );
this.setupArrowkeyEvents(hoursInputEl, minutesInputEl);
}

$scope.readonlyInput = angular.isDefined($attrs.readonlyInput) ? $scope.$parent.$eval($attrs.readonlyInput) : timepickerConfig.readonlyInput;
this.setupInputEvents( hoursInputEl, minutesInputEl );
this.setupInputEvents(hoursInputEl, minutesInputEl);
};

var hourStep = timepickerConfig.hourStep;
Expand Down Expand Up @@ -105,7 +105,7 @@ angular.module('ui.bootstrap.timepicker', [])
$scope.$parent.$watch($parse($attrs.showMeridian), function(value) {
$scope.showMeridian = !!value;

if ( ngModelCtrl.$error.time ) {
if (ngModelCtrl.$error.time) {
// Evaluate from template
var hours = getHoursFromTemplate(), minutes = getMinutesFromTemplate();
if (angular.isDefined( hours ) && angular.isDefined( minutes )) {
Expand Down Expand Up @@ -313,15 +313,15 @@ angular.module('ui.bootstrap.timepicker', [])
$scope.meridian = selected.getHours() < 12 ? meridians[0] : meridians[1];
}

function addMinutes(date, minutes) {
function addMinutes(date, minutes) {
var dt = new Date(date.getTime() + minutes * 60000);
var newDate = new Date(date);
newDate.setHours(dt.getHours(), dt.getMinutes());
return newDate;
}

function addMinutesToSelected(minutes) {
selected = addMinutes( selected, minutes );
selected = addMinutes(selected, minutes);
refresh();
}

Expand Down

0 comments on commit 0e32664

Please sign in to comment.