Skip to content

Commit 4862306

Browse files
committed
Allow setDates and setUTCDates to accept array arguments
1 parent a3348bb commit 4862306

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

docs/methods.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ Arguments:
7575

7676
* date[, date[, ...]] (Date)
7777

78-
Sets the internal date list. Each ``date`` is assumed to be a "local" date object, and will be converted to UTC for internal use. For use with multidate pickers.
78+
or
79+
80+
* [date[, date[, ...]]] (Array)
81+
82+
Sets the internal date list; accepts multiple dates or a single array of dates as arguments. Each ``date`` is assumed to mbe a "local" date object, and will be converted to UTC for internal use. For use with multidate pickers.
7983

8084

8185
setUTCDates
@@ -85,6 +89,10 @@ Arguments:
8589

8690
* date[, date[, ...]] (Date)
8791

92+
or
93+
94+
* [date[, date[, ...]]] (Array)
95+
8896
Sets the internal date list. Each ``date`` is assumed to be a UTC date object, and will not be converted. For use with multidate pickers.
8997

9098

js/bootstrap-datepicker.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,13 +481,15 @@
481481
},
482482

483483
setDates: function(){
484-
this.update.apply(this, arguments);
484+
var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
485+
this.update.apply(this, args);
485486
this._trigger('changeDate');
486487
this.setValue();
487488
},
488489

489490
setUTCDates: function(){
490-
this.update.apply(this, $.map(arguments, this._utc_to_local));
491+
var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
492+
this.update.apply(this, $.map(args, this._utc_to_local));
491493
this._trigger('changeDate');
492494
this.setValue();
493495
},

0 commit comments

Comments
 (0)