Datepicker control doesn't work when changing locale settings

When I change the locale to de-DE the datepicker control in the grid does not work. It doesn't even open.

When set to "en" there is no problem, everything works fine.
But if you try to set it to 'de-DE' it won't even open. And it throws some errors


Here is the code



1 Reply 1 reply marked as answer

VS Vignesh Sivagnanam Syncfusion Team March 22, 2021 10:49 AM UTC

Hi Stephan  

Greetings from Syncfusion support. 

Based on your query the locale (de-DE) is not applied to the datepicker control. We checked your code example and we suspect that there is mistake in the file path. In the attached screenshot there is no such file folder as de-DE while installing npm to the project.  

Screenshot:  

 

We have created a sample by providing the locale to the grid and datepicker. Please refer the below Code example and sample for your reference, 

Code example : 
<script> 
  document.addEventListener('DOMContentLoaded', function () { 
    var grid = document.getElementById('Grid').ej2_instances[0]; 
    var L10n = ej.base.L10n; 
    L10n.load({ 
      'de': { 
        'grid': { …………. }, 
        'pager': {……………..}, 
        'datepicker': { 
          placeholder: 'Wählen Sie ein Datum', 
          today: 'heute' 
        } 
      } 
    }); 
    loadCultureFiles('de'); 
    ej.base.setCulture('de'); 
    grid.locale = 'de'; 
  }); 

  function loadCultureFiles(name) { 
    var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json']; 
    debugger; 
    if (name === 'de') { 
      files.push('numberingSystems.json'); 
    } 
    var loader = ej.base.loadCldr; 
    var loadCulture = function (prop) { 
      var val, ajax; 
      if (name === 'de' && prop === files.length - 1) { 
        ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../node_modules/cldr-data/supplemental/' + '/' + files[prop], 'GET', false); 
      } else { 
        ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../node_modules/cldr-data/main/' + name + '/' + files[prop], 'GET', false); 
      } 
      ajax.onSuccess = function (value) { 
        val = value; 
      }; 
      ajax.send(); 
      loader(JSON.parse(val)); 
    }; 
    for (var prop = 0; prop < files.length; prop++) { 
      loadCulture(prop); 
    } 
  } 
</script> 


Regards 
Vignesh Sivagnanam 


Marked as answer
Loader.
Up arrow icon