Setting max date #2825
rhousham
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, I just wanted to show this as I've had a bit of a time to understand how this works and to get it working.
Basically I just wanted to set the max Date.
I've come up with this.
and within my razor view (c#) I've got.
@Html.EditorFor(m => Model.Meeting.Date, new { htmlAttributes = new { type = "text", @class = "form-control datepicker", data_maxdate = DateTime.Now } })which makes the html
<input class="form-control datepicker text-box single-line" data-maxdate="06/06/2023 15:48:10" data-val="true" data-val-date="The field Date must be a date." data-val-required="The Date field is required." id="Meeting_Date" name="Meeting.Date" type="text" value="06-Jun-2023" aria-invalid="false">Just wanted to 'show that off' as it could be useful to some people wondering how that all worked. (I need to double check that it works with the date part - but I have hopes!.
Beta Was this translation helpful? Give feedback.
All reactions