javascript - Change date in datepicker after change date on another datepicker with pickadate.js -
i'm using http://amsul.ca/pickadate.js/ , in homepage have 2 datepickers:
1) #departure
2) #return
everything works fine , i'm using additional code:
var frompic = $('#departure').pickadate(); var topic = $('#return').pickadate(); fromins = frompic.pickadate('picker'); toins = topic.pickadate('picker'); fromins.on('set', function(event) { if (event.select) { sel = fromins.get('select'); newdte = new date(sel.year, sel.month, sel.date); newdte.setdate(newdte.getdate() + 2); toins.set('min', new date(newdte.getfullyear(), newdte.getmonth(), newdte.getdate()));
by default these 2 inputs have default date set, example:
departure -> 10 september
return -> 17 september
right when change departure date have problem in return date because nothing happens here. example if choose departure on 25 september #return remain 17 september.
the code provided above allow me disable on #return dates before #departure don't find solution refresh #return change departure date.
any suggestion?
thanks
Comments
Post a Comment