尝试在ASP.NET MVC中使用jquery datepicker时遇到问题。当我使用jqueryui datepicker和jquery验证时,如果日期大于月份,我就无法保存。(例如11/12/2015
)。如果该日期少于一个月(Ex $("#Component_component_DateInService").datepicker({
dateFormat: 'dd/mm/yy'
});
),那么我的表单会保存日期。有人可以帮我解决这个问题吗?
这是代码示例:
<tr>
<td>CF Expiry Date</td>
<td>@Html.TextBoxFor(model => model.EquipmentStatutory.equipment_CfExpiryDate, new { @class = "mandatoryTextArea", @style = "width: 65px;", @required = "required" })</td>
</tr>
using System; using System.Collections.Generic;
public partial class ASSET_EquipmentStatutory
{
public string equipment_id { get; set; }
public string equipment_RegNo { get; set; }
public string equipment_CfNo { get; set; }
public Nullable<System.DateTime> equipment_CfExpiryDate { get; set; }
public string equipment_SSINo { get; set; }
public string equipment_CfMachineDescEN { get; set; }
public string equipment_CfMachineDescMY { get; set; }
}
document.getElementById("sweets").addEventListener('change', function (e) {
var sweets = e.target;
var str = "";
str += sweets.querySelector('option:checked').value;
document.querySelector("#target").value = str;
});