问题
By using the following
var maxDate = $( ".selector" ).datepicker( "option", "maxDate" );
The output can be anything from '+1M','+20Y', '12/12/2013' or more..
Are the '+1M' & '+20Y' examples something that can be used with native javascript to add to the current date so I'd be able to get an actual date object?
I would like to use this to validate the following function that is used by a set of presets (Current Week, Month, Day etc)
function SetDate(dateFrom, dateTo) {
$('.dateFrom').attr('value', dateFrom);
$('.dateTo').attr('value', dateTo);
}
Reference
回答1:
After a bit more searching I found this answer to "jQuery datepicker getMinDate '+1d'"
I decided to use the second example the user posted:
var minDateAttr = $(elem).datepicker("option", "minDate");
var inst = $(elem).data("datepicker");
var minDateObj = $.datepicker._determineDate(inst, minDateAttr, new Date());
来源:https://stackoverflow.com/questions/15618135/getting-date-object-from-jquery-ui-datepicker-maxdate-option