MVC3 Validation with ComponentModel.DataAnnotations for UK date format (also using jquery ui datepicker)

前端 未结 6 910
后悔当初
后悔当初 2021-01-05 14:25

I see there are some similar questions to this, but none solve my issue.

I am working on an MVC3 app with Entity Framework 4.3. I have a UK date field that i plan t

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-05 15:03

    Right, the problem was with the jquery validate scripts insisting on using the US datefomat. I will restrain my self from going on a proper rant about the fact that the majority of the world uses dd/mm/yyyy though.

    Anyway, eventually i found the answer to my woes in a comment to an answer of a similar question, the author of which kindly wrote a blog post about how he solved the issue.

    Basically I have used the jquery globalize script and just set the culture to en-GB. I should mention that in his blog he doesn't mention where to put the bit where you specify the culture, so i just shoved in in script tags in the page under the references to the globalization scripts:

    
    
    
    

提交回复
热议问题