The field must be a date - DatePicker validation fails in Chrome - mvc

后端 未结 6 1653
再見小時候
再見小時候 2020-12-03 04:48

I have strange problem. My date validation doesn\'t work in Chrome. I\'ve tried this answer but it didn\'t work for me.

I have this in my model:

[Dis         


        
6条回答
  •  爱一瞬间的悲伤
    2020-12-03 05:34

    The problem seems to be with (HTML5) as specification says that valid value is defined as RFC3339.

    So I changed my View to something like this:

    
    
    
    @Html.LabelFor(model => model.ValidFrom)
    @Html.HiddenFor(model => model.ValidFrom) @Html.ValidationMessageFor(model => model.ValidFrom)

    Hope it helps.

提交回复
热议问题