I have a small MVC 5 application which uses Arabic culture settings. I have a DateTime property in my model from this Razor syntax:
@Html.EditorFor(m => m.StartDate)
This DateTime
control appears on the form like this:
I need to convert this control to a Hijri format, is that possible?
The control rendered is a standard HTML5 input
with type date
.
I have seen some bug reports on the availability on globalization and the lack of other than Gregorian calendars. However, this is not something incorporated in the standard, it should be implemented in the browser:
The user interface is left up to the UA, so browsers are encouraged to provide such user options if it makes sense for their users' locale. (The submission format is always Gregorian, though.)
So as long as your browser supports the Hijri calendar (and you have the correct regional settings), you can use it. Otherwise you can't, and you should use another control that supports the calendar and write it back to an input
with type text
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With