如何使用 Jquery 全球化包进行日期验证

How to use Jquery globalization package for date validation

我的 jquery 日期验证脚本有问题,所以我安装了 jquery 全球化 package.I 我对软件包和软件包安装很陌生,所以我不是非常确定如何使用这些脚本。我尝试执行以下操作,但它仍然给我这个错误。

脚本文件夹中的所有内容

Views\User\Create.cshtml

中的代码段
   <% Html.EnableClientValidation(); %>
    <% using (Html.BeginForm())
    { %>
       <%: Html.ValidationSummary(false) %>
       <%: Html.EditorForModel() %>
        <p> <input type="submit" value="Create" /></p>
            <% } %>

    </fieldset>
}

Views\User\Create.cshtml

@model RecreationalServicesTicketingSystem.Models.User

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>User</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.LastName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.LastName)
            @Html.ValidationMessageFor(model => model.LastName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.FirstMidName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FirstMidName)
            @Html.ValidationMessageFor(model => model.FirstMidName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EnrollmentDate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EnrollmentDate)
            @Html.ValidationMessageFor(model => model.EnrollmentDate)
        </div>

    <% Html.EnableClientValidation(); %>
    <% using (Html.BeginForm())
    { %>
       <%: Html.ValidationSummary(false) %>
       <%: Html.EditorForModel() %>
        <p> <input type="submit" value="Create" /></p>
            <% } %>

    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

尝试这样的事情

@Html.TextBoxFor(m => m.DT_Project_Start, "{0:dd/mm/yyyy}")

看看它是否有效

我只需要将 en-NZ 添加到 jquery-ui-1.8.24.js 中的这一行代码中,日期验证就开始工作了

$.extend(this._defaults, this.regional['']);


$.extend(this._defaults, this.regional['en-NZ']);