How to control date format in igGrid
New DiscussionI have 2 controls on my page – an igGrid and an igDatePicker. Sometimes I need the date to display in en-US format and other times in en-GB format (and will be adding additional languages over time). I have the following includes to support localization.
<script src=”http://cdn-na.infragistics.com/igniteui/latest/js/modules/i18n/regional/infragistics.ui.regional-en.js”></script>
<script src=”http://cdn-na.infragistics.com/igniteui/latest/js/modules/i18n/regional/infragistics.ui.regional-en-GB.js”></script>
For the igDatePicker I set the regional option to either “en-US” or “en-GB”, depending upon the user’s language settings. This works fine.
However, how do I get the date in the igGrid to display correctly? The column is defined as show below.
{ headerText: “Date”, key: “Date”, width: 175, dataType: “date”, format: “dateTime” }
The value in the datasource has the format “yyyy-mm-ddThh:mm:ss” (I’ve also tried “yyyy-mm-dd hh:mm:ss”).
The date in the igGrid formats according to the last regional js file list. In this example, the date is displayed in the igGrid as dd/mm/yyyy hh:mm (for language en-GB).
If the order of the regional js files is switched, the date in the igGrid displays as mm/dd/yyyy hh:mm AM/PM (either AM or PM is displayed) (for language en-US).
How do I get the igGrid date to display according to the user’s language settings. I cannot find an option similar to the one for the igDatePicker.
Thanks for any assistance.