var LEFT_CAL = new Calendar({ inputField: "f_date_a", dateFormat: "%d.%m.%Y", trigger: "f_date_a", bottomBar: true, weekNumbers: true, showTime: 12, animation: false, onSelect: function() { var date = Calendar.intToDate(this.selection.get()); date = new Date(date.getFullYear(), date.getMonth(), date.getDate()+1); RIGHT_CAL.args.min = date; RIGHT_CAL.redraw(); this.hide(); } }); var RIGHT_CAL = new Calendar({ inputField: "f_calcdate", dateFormat: "%d.%m.%Y", trigger: "f_calcdate", bottomBar: true, weekNumbers: true, showTime: 12, animation: false, onSelect: function() { var date = Calendar.intToDate(this.selection.get()); date = new Date(date.getFullYear(), date.getMonth(), date.getDate()-1); LEFT_CAL.args.max = date; LEFT_CAL.redraw(); this.hide(); } }); var date1 = LEFT_CAL.args.date; date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate()+2); RIGHT_CAL.args.min = date1; RIGHT_CAL.redraw(); var date2 = RIGHT_CAL.args.date; date2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate()+1); LEFT_CAL.args.max = date2; LEFT_CAL.redraw();