'Can I convert an HTML date picker to a Hijri calendar format?
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?
Solution 1:[1]
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
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |