0

I have a edit page for the deviceassignments and when i click on save when i change le "status du prêt" for example, i have this errorthis error with my DateLoan and my DateReturned. When i create a deviceAssignemnts i use a datepicker calendar and DateTime.Now in controller who save my date with this format (28/08/2018 00:00:00) but if i'm on the edit page i have to change manually my month (ex: "08" to "Aug")to be able to save

This is my model :

    public Nullable<System.DateTime> DateLoan { get; set; }
    public Nullable<System.DateTime> DateReturned { get; set; }

This my Html:

<div class="form-group">
                                @Html.LabelFor(model => model.DateLoan, Resource.DateLoan, htmlAttributes: new { @class = "control-label col-md-8" })
                                <div class="input-group col-md-5">
                                    @Html.EditorFor(model => model.DateLoan, new { htmlAttributes = new { @class = "form-control" } })
                                    @Html.ValidationMessageFor(model => model.DateLoan, "", new { @class = "text-danger" })
                                </div>
                            </div>

                            <div id="addDate">
                                <div class="form-group">
                                    @Html.LabelFor(model => model.DateReturned, Resource.DateReturned, htmlAttributes: new { @class = "control-label col-md-8" })
                                    <div class="input-group col-md-5">
                                        @Html.EditorFor(model => model.DateReturned, new { htmlAttributes = new { @class = "form-control" } })
                                        @Html.ValidationMessageFor(model => model.DateReturned, "", new { @class = "text-danger" })
                                    </div>
                                </div>
                            </div>

And this is my script:

$('input[type=datetime]').datepicker({
                 dateFormat: "dd/M/yy",
                 changeMonth: true,
                 changeYear: true,
                 yearRange: "-60:+0"
             });

0 Answers0