简体   繁体   中英

Disable future dates in Dojo Date Picker?

我想在dojo date Picker中禁用将来的日期。

<input dojoType="dijit.form.DateTextBox"/>
dijit.byId('textBoxID').constraints.max = new Date();

I'm no dojo expert, but I think that should do it. Subtract 1 day from the new date if you want to disallow today as well.

<div id="mycal" data-dojo-type="dijit.Calendar" value="2009-08-07" data-dojo-props="isDisabledDate:dojo.date.locale.isWeekend"></div>

  dojo.require("dijit.dijit"); // loads the optimized dijit layer dojo.require("dijit.Calendar"); dojo.ready(function () { new dijit.Calendar({ value: new Date(), isDisabledDate: function (d) { var d = new Date(d); d.setHours(0, 0, 0, 0); var today = new Date(); today.setHours(0, 0, 0, 0); return dojo.date.difference(today, d) < 0; } }, "mycal"); }); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM