File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -140,15 +140,16 @@ $.date = function( datestring, formatstring ) {
140
140
} ,
141
141
// specialized for multi-month template, could be used in general
142
142
months : function ( add ) {
143
- var result = [ ] ,
144
- current = date . getMonth ( ) ;
145
- for ( var i = 0 ; i < add + 1 ; i ++ ) {
146
- result . push ( this . clone ( ) ) ;
147
- this . adjust ( "M" , 1 ) ;
143
+ var clone ,
144
+ result = [ this ] ;
145
+
146
+ for ( var i = 0 ; i < add ; i ++ ) {
147
+ clone = this . clone ( ) ;
148
+ clone . adjust ( "M" , i + 1 ) ;
149
+ result . push ( clone ) ;
148
150
}
149
151
result [ 0 ] . first = true ;
150
152
result [ result . length - 1 ] . last = true ;
151
- date . setMonth ( current ) ;
152
153
return result ;
153
154
} ,
154
155
iso8601Week : function ( date ) {
Original file line number Diff line number Diff line change @@ -292,11 +292,13 @@ $.widget( "ui.datepicker", {
292
292
} ,
293
293
_buildMultiplePicker : function ( ) {
294
294
var html = "" ,
295
- // TODO: All months returned by months() are the same?
295
+ currentDate = this . date ,
296
296
months = this . date . months ( this . options . numberOfMonths - 1 ) ,
297
297
i = 0 ;
298
298
299
299
for ( i ; i < months . length ; i ++ ) {
300
+ this . date = months [ i ] ;
301
+
300
302
html += "<div class='ui-datepicker-group'>" +
301
303
"<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all'>" ;
302
304
if ( months [ i ] . first ) {
@@ -306,8 +308,6 @@ $.widget( "ui.datepicker", {
306
308
html += this . _buildNextLink ( ) ;
307
309
}
308
310
309
- // TODO: Change _buildTitlebar and _buildGrid to handle for multiple months.
310
- // Right now they just use this.date.
311
311
html += this . _buildTitlebar ( ) ;
312
312
html += "</div>" ;
313
313
html += this . _buildGrid ( ) ;
@@ -317,6 +317,7 @@ $.widget( "ui.datepicker", {
317
317
html += "<div class='ui-datepicker-row-break'></div>" ;
318
318
html += this . _buildButtons ( ) ;
319
319
320
+ this . date = currentDate ;
320
321
return html ;
321
322
} ,
322
323
_buildHeader : function ( ) {
You can’t perform that action at this time.
0 commit comments