@@ -143,17 +143,6 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
143
143
return arrays ;
144
144
} ;
145
145
146
- // Fix a hard-reprodusible bug with timezones
147
- // The bug depends on OS, browser, current timezone and current date
148
- // i.e.
149
- // var date = new Date(2014, 0, 1);
150
- // console.log(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours());
151
- // can result in "2013 11 31 23" because of the bug.
152
- this . fixTimeZone = function ( date ) {
153
- var hours = date . getHours ( ) ;
154
- date . setHours ( hours === 23 ? hours + 2 : 0 ) ;
155
- } ;
156
-
157
146
$scope . select = function ( date ) {
158
147
if ( $scope . datepickerMode === self . minMode ) {
159
148
var dt = ngModelCtrl . $viewValue ? new Date ( ngModelCtrl . $viewValue ) : new Date ( 0 , 0 , 0 , 0 , 0 , 0 , 0 ) ;
@@ -238,7 +227,6 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
238
227
var dates = new Array ( n ) , current = new Date ( startDate ) , i = 0 , date ;
239
228
while ( i < n ) {
240
229
date = new Date ( current ) ;
241
- this . fixTimeZone ( date ) ;
242
230
dates [ i ++ ] = date ;
243
231
current . setDate ( current . getDate ( ) + 1 ) ;
244
232
}
@@ -248,8 +236,11 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
248
236
this . _refreshView = function ( ) {
249
237
var year = this . activeDate . getFullYear ( ) ,
250
238
month = this . activeDate . getMonth ( ) ,
251
- firstDayOfMonth = new Date ( year , month , 1 ) ,
252
- difference = this . startingDay - firstDayOfMonth . getDay ( ) ,
239
+ firstDayOfMonth = new Date ( this . activeDate ) ;
240
+
241
+ firstDayOfMonth . setFullYear ( year , month , 1 ) ;
242
+
243
+ var difference = this . startingDay - firstDayOfMonth . getDay ( ) ,
253
244
numDisplayedFromPreviousMonth = ( difference > 0 ) ? 7 - difference : - difference ,
254
245
firstDate = new Date ( firstDayOfMonth ) ;
255
246
@@ -340,8 +331,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
340
331
date ;
341
332
342
333
for ( var i = 0 ; i < 12 ; i ++ ) {
343
- date = new Date ( year , i , 1 ) ;
344
- this . fixTimeZone ( date ) ;
334
+ date = new Date ( this . activeDate ) ;
335
+ date . setFullYear ( year , i , 1 ) ;
345
336
months [ i ] = angular . extend ( this . createDateObject ( date , this . formatMonth ) , {
346
337
uid : scope . uniqueId + '-' + i
347
338
} ) ;
@@ -395,8 +386,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
395
386
var years = new Array ( range ) , date ;
396
387
397
388
for ( var i = 0 , start = getStartingYear ( this . activeDate . getFullYear ( ) ) ; i < range ; i ++ ) {
398
- date = new Date ( start + i , 0 , 1 ) ;
399
- this . fixTimeZone ( date ) ;
389
+ date = new Date ( this . activeDate ) ;
390
+ date . setFullYear ( start + i , 0 , 1 ) ;
400
391
years [ i ] = angular . extend ( this . createDateObject ( date , this . formatYear ) , {
401
392
uid : scope . uniqueId + '-' + i
402
393
} ) ;
0 commit comments