InputDate Ranges
Use the InputDate's min and max properties to restrict the range of dates that can be entered.
For example, the InputDate below only accepts dates within the current week:
1 2 3 4 5 6 7 8 9 10 11 12 | // This file locates: "Scripts/Lesson/C1Input/InputDateRanges.js". c1.documentReady(function () { // InputDate with a range restriction var theInputDate = wijmo.Control.getControl( '#theInputDate' ); var curr = new Date(), firstDay = new Date(curr.setDate(curr.getDate() - curr.getDay())), lastDay = new Date(curr.setDate(curr.getDate() - curr.getDay() + 6)); theInputDate.min = firstDay; theInputDate.max = lastDay; }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 | using System.Web.Mvc; namespace LearnMvcClient.Controllers { public partial class C1InputController : Controller { // GET: InputDateRanges public ActionResult InputDateRanges() { return View(); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | < h1 > @Html .Raw(Resources.C1Input.InputDateRanges_Title) </ h1 > < p > @Html .Raw(Resources.C1Input.InputDateRanges_Text1) </ p > < p > @Html .Raw(Resources.C1Input.InputDateRanges_Text2) </ p > < div class = "demo-settings" > < label for = "theInputDate" > @Html .Raw(Resources.C1Input.InputDateRanges_Text3)</ label > @Html .C1().InputDate().Id( "theInputDate" ).Format( "MMM dd, yyyy" ) </ div > |