Merge pull request #1627 from laltin/patch-getter-limits

add getter methods for date limits
This commit is contained in:
Jeroen Thora 2015-11-24 11:05:20 +01:00
commit 352c19fd4d
3 changed files with 42 additions and 0 deletions

View File

@ -144,6 +144,22 @@ Arguments: None
Returns the internal list of UTC date objects, as they are and unconverted to local time, of the first datepicker in the selection. For use with multidate pickers.
getStartDate
------------
Arguments: None
Returns the lower date limit on the datepicker.
getEndDate
----------
Arguments: None
Returns the upper date limit on the datepicker.
setStartDate
------------

View File

@ -623,6 +623,10 @@
return DPGlobal.formatDate(d, format, lang);
}).join(this.o.multidateSeparator);
},
getStartDate: function(){
return this.o.startDate;
},
setStartDate: function(startDate){
this._process_options({startDate: startDate});
@ -630,6 +634,10 @@
this.updateNavArrows();
return this;
},
getEndDate: function(){
return this.o.endDate;
},
setEndDate: function(endDate){
this._process_options({endDate: endDate});

View File

@ -92,6 +92,24 @@ test('setEndDate', function(){
strictEqual(returnedObject, this.dp, "is chainable");
});
test('getStartDate', function(){
var date_in = new Date(Date.UTC(2012, 3, 5)),
expected_date = date_in,
returnedObject = this.dp.setStartDate(date_in);
// ...
datesEqual(returnedObject.getStartDate(), expected_date);
strictEqual(returnedObject, this.dp, "is chainable");
});
test('getEndDate', function(){
var date_in = new Date(Date.UTC(2012, 3, 5)),
expected_date = date_in,
returnedObject = this.dp.setEndDate(date_in);
// ...
datesEqual(returnedObject.getEndDate(), expected_date);
strictEqual(returnedObject, this.dp, "is chainable");
});
test('setDaysOfWeekDisabled - String', function(){
var days_in = "0,6",
expected_days = [0,6],