@@ -21,7 +21,7 @@ angular.module('ui.bootstrap.datetimepicker', [])
2121 startView : 'day'
2222 } )
2323 . directive ( 'datetimepicker' , [ '$log' , 'dateTimePickerConfig' , function ( $log , defaultConfig ) {
24- " use strict" ;
24+ ' use strict' ;
2525
2626 function DateObject ( ) {
2727
@@ -46,82 +46,80 @@ angular.module('ui.bootstrap.datetimepicker', [])
4646 for ( var prop in configuration ) {
4747 //noinspection JSUnfilteredForInLoop
4848 if ( validOptions . indexOf ( prop ) < 0 ) {
49- throw ( " invalid option: " + prop ) ;
49+ throw ( ' invalid option: ' + prop ) ;
5050 }
5151 }
5252
5353 // Order of the elements in the validViews array is significant.
5454 var validViews = [ 'minute' , 'hour' , 'day' , 'month' , 'year' ] ;
5555
5656 if ( validViews . indexOf ( configuration . startView ) < 0 ) {
57- throw ( " invalid startView value: " + configuration . startView ) ;
57+ throw ( ' invalid startView value: ' + configuration . startView ) ;
5858 }
5959
6060 if ( validViews . indexOf ( configuration . minView ) < 0 ) {
61- throw ( " invalid minView value: " + configuration . minView ) ;
61+ throw ( ' invalid minView value: ' + configuration . minView ) ;
6262 }
6363
6464 if ( validViews . indexOf ( configuration . minView ) > validViews . indexOf ( configuration . startView ) ) {
65- throw ( " startView must be greater than minView" ) ;
65+ throw ( ' startView must be greater than minView' ) ;
6666 }
6767
6868 if ( ! angular . isNumber ( configuration . minuteStep ) ) {
69- throw ( " minuteStep must be numeric" ) ;
69+ throw ( ' minuteStep must be numeric' ) ;
7070 }
7171 if ( configuration . minuteStep <= 0 || configuration . minuteStep >= 60 ) {
72- throw ( " minuteStep must be greater than zero and less than 60" ) ;
72+ throw ( ' minuteStep must be greater than zero and less than 60' ) ;
7373 }
7474 if ( configuration . dropdownSelector !== null && ! angular . isString ( configuration . dropdownSelector ) ) {
75- throw ( " dropdownSelector must be a string" ) ;
75+ throw ( ' dropdownSelector must be a string' ) ;
7676 }
7777
78- if ( configuration . dropdownSelector != null ) {
79- /* istanbul ignore next */
80- if ( ( typeof jQuery === 'undefined' ) || ( typeof jQuery ( ) . dropdown !== 'function' ) ) {
81- $log . error ( "Please DO NOT specify the dropdownSelector option unless you are using jQuery AND Bootstrap.js. " +
82- "Please include jQuery AND Bootstrap.js, or write code to close the dropdown in the on-set-time callback. \n\n" +
83- "The dropdownSelector configuration option is being removed because it will not function properly." ) ;
84- delete configuration . dropdownSelector ;
85- }
78+ /* istanbul ignore next */
79+ if ( configuration . dropdownSelector !== null && ( ( typeof jQuery === 'undefined' ) || ( typeof jQuery ( ) . dropdown !== 'function' ) ) ) {
80+ $log . error ( 'Please DO NOT specify the dropdownSelector option unless you are using jQuery AND Bootstrap.js. ' +
81+ 'Please include jQuery AND Bootstrap.js, or write code to close the dropdown in the on-set-time callback. \n\n' +
82+ 'The dropdownSelector configuration option is being removed because it will not function properly.' ) ;
83+ delete configuration . dropdownSelector ;
8684 }
8785 } ;
8886
8987 return {
9088 restrict : 'E' ,
9189 require : 'ngModel' ,
92- template : " <div class=' datetimepicker table-responsive'>" +
93- " <table class=' table table-striped'>" +
94- " <thead>" +
95- " <tr>" +
96- " <th class=' left' data-ng-click=' changeView(data.currentView, data.leftDate, $event)' data-ng-show=' data.leftDate.selectable' ><i class=' glyphicon glyphicon-arrow-left' /></th>" +
97- " <th class=' switch' colspan='5' data-ng-show=' data.previousViewDate.selectable' data-ng-click=' changeView(data.previousView, data.previousViewDate, $event)' >{{ data.previousViewDate.display }}</th>" +
98- " <th class=' right' data-ng-click=' changeView(data.currentView, data.rightDate, $event)' data-ng-show=' data.rightDate.selectable' ><i class=' glyphicon glyphicon-arrow-right' /></th>" +
99- " </tr>" +
100- " <tr>" +
101- " <th class=' dow' data-ng-repeat=' day in data.dayNames' >{{ day }}</th>" +
102- " </tr>" +
103- " </thead>" +
104- " <tbody>" +
105- " <tr data-ng-if=' data.currentView !== \" day\"' >" +
106- " <td colspan='7' >" +
107- " <span class=' {{ data.currentView }}' " +
108- " data-ng-repeat=' dateObject in data.dates' " +
109- " data-ng-class=' {active: dateObject.active, past: dateObject.past, future: dateObject.future, disabled: !dateObject.selectable}' " +
110- " data-ng-click=\ "changeView(data.nextView, dateObject, $event)\ ">{{ dateObject.display }}</span> " +
111- " </td>" +
112- " </tr>" +
113- " <tr data-ng-if=' data.currentView === \" day\"' data-ng-repeat=' week in data.weeks'>" +
114- " <td data-ng-repeat=' dateObject in week.dates' " +
115- " data-ng-click=' changeView(data.nextView, dateObject, $event)'" +
116- " class=' day' " +
117- " data-ng-class=' {active: dateObject.active, past: dateObject.past, future: dateObject.future, disabled: !dateObject.selectable}' >{{ dateObject.display }}</td>" +
118- " </tr>" +
119- " </tbody>" +
120- " </table></div>" ,
90+ template : ' <div class=" datetimepicker table-responsive">' +
91+ ' <table class=" table table-striped">' +
92+ ' <thead>' +
93+ ' <tr>' +
94+ ' <th class=" left" data-ng-click=" changeView(data.currentView, data.leftDate, $event)" data-ng-show=" data.leftDate.selectable" ><i class=" glyphicon glyphicon-arrow-left" /></th>' +
95+ ' <th class=" switch" colspan="5" data-ng-show=" data.previousViewDate.selectable" data-ng-click=" changeView(data.previousView, data.previousViewDate, $event)" >{{ data.previousViewDate.display }}</th>' +
96+ ' <th class=" right" data-ng-click=" changeView(data.currentView, data.rightDate, $event)" data-ng-show=" data.rightDate.selectable" ><i class=" glyphicon glyphicon-arrow-right" /></th>' +
97+ ' </tr>' +
98+ ' <tr>' +
99+ ' <th class=" dow" data-ng-repeat=" day in data.dayNames" >{{ day }}</th>' +
100+ ' </tr>' +
101+ ' </thead>' +
102+ ' <tbody>' +
103+ ' <tr data-ng-if=" data.currentView !== \' day\'" >' +
104+ ' <td colspan="7" >' +
105+ ' <span class=" {{ data.currentView }}" ' +
106+ ' data-ng-repeat=" dateObject in data.dates" ' +
107+ ' data-ng-class=" {active: dateObject.active, past: dateObject.past, future: dateObject.future, disabled: !dateObject.selectable}" ' +
108+ ' data-ng-click="changeView(data.nextView, dateObject, $event)">{{ dateObject.display }}</span> ' +
109+ ' </td>' +
110+ ' </tr>' +
111+ ' <tr data-ng-if=" data.currentView === \' day\'" data-ng-repeat=" week in data.weeks">' +
112+ ' <td data-ng-repeat=" dateObject in week.dates" ' +
113+ ' data-ng-click=" changeView(data.nextView, dateObject, $event)"' +
114+ ' class=" day" ' +
115+ ' data-ng-class=" {active: dateObject.active, past: dateObject.past, future: dateObject.future, disabled: !dateObject.selectable}" >{{ dateObject.display }}</td>' +
116+ ' </tr>' +
117+ ' </tbody>' +
118+ ' </table></div>' ,
121119 scope : {
122- ngModel : "=" ,
123- onSetTime : "&" ,
124- beforeRender : "&"
120+ ngModel : '=' ,
121+ onSetTime : '&' ,
122+ beforeRender : '&'
125123 } ,
126124 replace : true ,
127125 link : function ( scope , element , attrs , ngModelController ) {
@@ -163,7 +161,7 @@ angular.module('ui.bootstrap.datetimepicker', [])
163161 'dates' : [ ]
164162 } ;
165163
166- for ( var i = 0 ; i < 12 ; i ++ ) {
164+ for ( var i = 0 ; i < 12 ; i += 1 ) {
167165 var yearMoment = moment . utc ( startDate ) . add ( i , 'years' ) ;
168166 var dateValue = {
169167 'dateValue' : yearMoment . valueOf ( ) ,
@@ -198,7 +196,7 @@ angular.module('ui.bootstrap.datetimepicker', [])
198196 'dates' : [ ]
199197 } ;
200198
201- for ( var i = 0 ; i < 12 ; i ++ ) {
199+ for ( var i = 0 ; i < 12 ; i += 1 ) {
202200 var monthMoment = moment . utc ( startDate ) . add ( i , 'months' ) ;
203201 var dateValue = {
204202 'dateValue' : monthMoment . valueOf ( ) ,
@@ -238,13 +236,13 @@ angular.module('ui.bootstrap.datetimepicker', [])
238236 } ;
239237
240238
241- for ( var dayNumber = 0 ; dayNumber < 7 ; dayNumber ++ ) {
239+ for ( var dayNumber = 0 ; dayNumber < 7 ; dayNumber += 1 ) {
242240 result . dayNames . push ( moment . utc ( ) . weekday ( dayNumber ) . format ( 'dd' ) ) ;
243241 }
244242
245- for ( var i = 0 ; i < 6 ; i ++ ) {
243+ for ( var i = 0 ; i < 6 ; i += 1 ) {
246244 var week = { dates : [ ] } ;
247- for ( var j = 0 ; j < 7 ; j ++ ) {
245+ for ( var j = 0 ; j < 7 ; j += 1 ) {
248246 var monthMoment = moment . utc ( startDate ) . add ( ( i * 7 ) + j , 'days' ) ;
249247 var dateValue = {
250248 'dateValue' : monthMoment . valueOf ( ) ,
@@ -280,7 +278,7 @@ angular.module('ui.bootstrap.datetimepicker', [])
280278 'dates' : [ ]
281279 } ;
282280
283- for ( var i = 0 ; i < 24 ; i ++ ) {
281+ for ( var i = 0 ; i < 24 ; i += 1 ) {
284282 var hourMoment = moment . utc ( selectedDate ) . add ( i , 'hours' ) ;
285283 var dateValue = {
286284 'dateValue' : hourMoment . valueOf ( ) ,
@@ -314,7 +312,7 @@ angular.module('ui.bootstrap.datetimepicker', [])
314312
315313 var limit = 60 / configuration . minuteStep ;
316314
317- for ( var i = 0 ; i < limit ; i ++ ) {
315+ for ( var i = 0 ; i < limit ; i += 1 ) {
318316 var hourMoment = moment . utc ( selectedDate ) . add ( i * configuration . minuteStep , 'minute' ) ;
319317 var dateValue = {
320318 'dateValue' : hourMoment . valueOf ( ) ,
@@ -361,9 +359,9 @@ angular.module('ui.bootstrap.datetimepicker', [])
361359
362360 var weekDates = [ ] ;
363361 if ( result . weeks ) {
364- for ( var i = 0 ; i < result . weeks . length ; i ++ ) {
362+ for ( var i = 0 ; i < result . weeks . length ; i += 1 ) {
365363 var week = result . weeks [ i ] ;
366- for ( var j = 0 ; j < week . dates . length ; j ++ ) {
364+ for ( var j = 0 ; j < week . dates . length ; j += 1 ) {
367365 var weekDate = week . dates [ j ] ;
368366 weekDates . push ( weekDate ) ;
369367 }
0 commit comments