Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DateTime control supporting Hijri calendar

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:

standard HTML date picker

I need to convert this control to a Hijri format, is that possible?

like image 793
Abraham Josef Avatar asked Sep 28 '22 18:09

Abraham Josef


1 Answers

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.

like image 110
Patrick Hofman Avatar answered Oct 01 '22 04:10

Patrick Hofman