Skip to content

Commit a083fe8

Browse files
committed
Merge pull request uxsolutions#269 from macodev/master
Minor js tweaks and fixes by linting the code
2 parents 42898cf + 109de23 commit a083fe8

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

js/bootstrap-datepicker.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
$(document).on('mousedown', function (e) {
6161
// Clicked outside the datepicker, hide it
62-
if ($(e.target).closest('.datepicker').length == 0) {
62+
if ($(e.target).closest('.datepicker').length === 0) {
6363
that.hide();
6464
}
6565
});
@@ -78,6 +78,7 @@
7878
this.keyboardNavigation = this.element.data('date-keyboard-navigation');
7979
}
8080

81+
this.viewMode = this.startViewMode = 0;
8182
switch(options.startView || this.element.data('date-start-view')){
8283
case 2:
8384
case 'decade':
@@ -87,11 +88,6 @@
8788
case 'year':
8889
this.viewMode = this.startViewMode = 1;
8990
break;
90-
case 0:
91-
case 'month':
92-
default:
93-
this.viewMode = this.startViewMode = 0;
94-
break;
9591
}
9692

9793
this.todayBtn = (options.todayBtn||this.element.data('date-today-btn')||false);
@@ -208,7 +204,7 @@
208204

209205
getDate: function() {
210206
var d = this.getUTCDate();
211-
return new Date(d.getTime() + (d.getTimezoneOffset()*60000))
207+
return new Date(d.getTime() + (d.getTimezoneOffset()*60000));
212208
},
213209

214210
getUTCDate: function() {
@@ -294,8 +290,8 @@
294290
},
295291

296292
fillDow: function(){
297-
var dowCnt = this.weekStart;
298-
var html = '<tr>';
293+
var dowCnt = this.weekStart,
294+
html = '<tr>';
299295
while (dowCnt < this.weekStart + 7) {
300296
html += '<th class="dow">'+dates[this.language].daysMin[(dowCnt++)%7]+'</th>';
301297
}
@@ -304,8 +300,8 @@
304300
},
305301

306302
fillMonths: function(){
307-
var html = '';
308-
var i = 0
303+
var html = '',
304+
i = 0;
309305
while (i < 12) {
310306
html += '<span class="month">'+dates[this.language].monthsShort[i++]+'</span>';
311307
}
@@ -500,7 +496,7 @@
500496
var year = this.viewDate.getUTCFullYear(),
501497
month = this.viewDate.getUTCMonth();
502498
if (target.is('.old')) {
503-
if (month == 0) {
499+
if (month === 0) {
504500
month = 11;
505501
year -= 1;
506502
} else {
@@ -720,7 +716,7 @@
720716
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
721717
today: "Today"
722718
}
723-
}
719+
};
724720

725721
var DPGlobal = {
726722
modes: [

0 commit comments

Comments
 (0)