Question

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

Was it helpful?

Solution

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());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top