Using the Ethiopian Calendar Date Picker.
1. Date picker data
The Date Picker has been re-factored to minimize the code required to use it. Converting to Eth calendar when rendering it on views is no more required. Converting dates to back to GC at the controllers is not required either.
Eg If the form has ExpiryDate field, we need to add the css class "cats-calendarpicker" and the script will take care of the rest.
Example Usage
@Html.TextBoxFor(model => model.ExpiryDate, new { @class = "cats-datepicker"})
If the user's default calendar is Eth, the above code will do two things.
- During view rendering, the ExpiryDate will show the Ethiopian Date.
- During form submit model.ExpiryDate will have the Gregorian Date.
2. Date fields label
Rendering Date label based on user date preference, If user date preference is Ethiopian date "(EC)" will be used or if Gregorian "(GC)" will be used otherwise.
Example , let's take ExpiryDate
Case 1: If ExpiryDate is on the form use
Example Usage
@Html.LabelFor(model => model.ExpiryDate ,new {@class="cats-date-pref"})
Case 2:If ExpiryDate is on the Kendo Grid
Example Usage
columns.Bound(p => p.ExpiryDate).HeaderHtmlAttributes(new { @class = "cats-date-pref-grid" }).Width(160);