Hi,
I'm working on a ASP MVC web application that use igGrid to display data in my index views. The application isn't localized, but I still need date and time to be formatted according to the settings in the browser (as it is in my other views). I can format the displayed date/time in the column with FormatterFunction(), calling a function which returns a toLocaleString(), but I can't find a way to get the same formatting in the filter pattern edit or igDatePicker that's used too. Is there any way to format the filter input pattern and the igDatePicker output string to a local data/time format? In my current state filtering doesn't work as the date/time is formatted to an incorrect format.
The format for the column is "dateTime" and all dates/times is saved as UTC. EnableUTCDates is true for the grid.
This application will be used by people from different countries with different date/time formats. Therefore it's necessary for it to handle this correctly, both format and time zone.
Ex.
Using a browser with swedish language settings I want the date and time formatted as yyyy'-'MM'-'dd'T'HH':'mm':'ss = 2015-11-19 10:07:00, but filter date and time is locked at a pattern as 11/19/2015 10:07 AM
Kind regards
FW
Hello Fredrik,
I’m just following up to see if you’ve been able to resolve your issue.
If you have any questions or concerns or if you need further assistance please let me know.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://ko.infragistics.com/support
Thank you for posting in our forum.
I suggest you apply the current locale from the Request via the igLoader – this will ensure that the related locale files that contains the locale information ( like the different formatting for Dates, Numbers etc.) will be loaded on the page and all IgniteUI controls will use them.
You can get the current locale from the Request.UseLanguages array on the server side and apply the related . For example:
@(Html.Infragistics().Loader().ScriptPath("http://cdn-na.infragistics.com/igniteui/2015.2/latest/js/")
.CssPath("http://cdn-na.infragistics.com/igniteui/2015.2/latest/css/")
.Locale(Request.UserLanguages.FirstOrDefault()).Render()
)
You could also modify directly the date formats on the client-side, however for that you would need to be able to determine the correct date locale format on the client-side and apply it. For example:
<script>
$.ig.loader(function () {
$.ig.regional.defaults["datePattern"] = "M/d/yyyy";
});
</script>
Let me know if you have any questions or concerns.