Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2515
How to change date patterns for different regions
posted

We are using igLoader to take advantage of the regional support provided by igniteUI. The following is how we instantiate the loader. This appears to work fine.

However, we want the dateTime pattern to be MM/dd/yyyy HH:mm, so we modified the Infragistics.ui.regional-en.js file in the js/modules/i18n/regional folder to indicate these patterns. However, we still get the pattrn M/d/yyyy hh:mm tt when running with the US region.

In this instance, the regional option is begin set to 'en'. Using 'en-US' fails.

How do we change the patterns used for US (or an other region)?

 <script type="text/javascript" src="../igniteui/2015.2/js/infragistics.loader.js"></script>

<script>
 function getLang()
 {
  var lang;
  if (navigator.browserLanguage != undefined)
   lang = navigator.browserLanguage;
  else if (navigator.languages != undefined)
   lang = navigator.languages[0];
  else
   lang = navigator.language;
  
  if (lang == "en-US") lang = "en";
  
  return lang;
 }

 $.ig.loader({
  scriptPath: "../igniteui/2015.2/js/",
  cssPath: "../igniteui/2015.2/css/",
  resources: "igGrid.*,igDialog,igCombo,igHierarchicalGrid.*",
  regional: getLang()
  });
</script>

Parents
No Data
Reply
  • 15320
    Offline posted

    Hello hrwebb,

    After further investigation it seems that if you set igLoader regional property to "en", the grid loads the default regional settings, without explicitly loading the infragistics.ui.regional-en.js file which you've been modified. If you want the modified regional-en file to be explicitly loaded, you may either pass its relative path to the igLoader resources property, for example:

    $.ig.loader({

       scriptPath: "http://localhost/ig_ui15.2/js/",

       cssPath: "http://localhost/ig_ui15.2/css/",

       resources: "igGrid.*, ../js/modules/i18n/regional/infragistics.ui.regional-en.js",

       locale: "en",

       regional: "en"

      });

    or set the following before grid initialization:

    $.ig.regional.defaults.dateTimePattern= "MM/dd/yyyy HH:mm";

    However please note that both approaches work when you set format option to the respective date column. For the current case the format option should be 'dataTime'. If you have any questions, please let me know.


    Regards,

    Tsanna

Children