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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -