javascript - How to set the datepicker maxDate based on another datepicker? -


i have declared date picker:

define(["ui/nal.ui.core"], function () {     $.widget("nal.datepi", {         options: {             numberofmonths: 2         },         _create: function () {             var $el = this.element;             $el.datepicker(this.options);         }     }); }); 

which has 2 sons:

define(["ui/nal.ui.datepi","ui/nal.ui.textfielddatedeparture"], function() {     $.widget( "lan.datepideparture", $.lan.datepi, {     }); }); define(["ui/nal.ui.datepi","ui/nal.ui.textfielddatearrival"], function() {     $.widget( "lan.datepiarrival", $.lan.datepi, {     }); }); 

how can set maxdate on arrival 1 year depending on departure.

would simpler work: (just pseudocode)

var depdate = $(".divtodate").datepicker('getdate'); depdate.setdate(depdate.getyear() + 1);  (".arrivaldiv").datepicker({     maxdate: depdate; 

basically grab date associated arrival date datepicker , add year , set maxdate new value. might have getdate , use .addyear()


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -