scheduler with locale pt-BR Uncaught TypeError Cannot read properties of undefined reading trim

Hello, when I'm using the simple schudule component and I set locale="pt-BR" I'm getting the error as shown in the attached figure, when I remove the locale or leave it as "en-US" it works without a problem. Could you check the error? Here's the project with the error for you to check. Thank you


Uncaught TypeError: Cannot read properties of undefined (reading 'trim')

    at oUe.formatDateRange (ej2.min.js?v=h9II3LmWbVbj0AxjRJnt7K9h-08vMtVsXRCj6Edh3yQ:10:8533985)

    at oUe.getDateRangeText (ej2.min.js?v=h9II3LmWbVbj0AxjRJnt7K9h-08vMtVsXRCj6Edh3yQ:10:8533572)

    at D2e.updateDateRange (ej2.min.js?v=h9II3LmWbVbj0AxjRJnt7K9h-08vMtVsXRCj6Edh3yQ:10:7969901)

    at s4e.updateHeader (ej2.min.js?v=h9II3LmWbVbj0AxjRJnt7K9h-08vMtVsXRCj6Edh3yQ:10:8311325)

    at s4e.initializeLayout (ej2.min.js?v=h9II3LmWbVbj0AxjRJnt7K9h-08vMtVsXRCj6Edh3yQ:10:8310562)

    at s4e.render (ej2.min.js?v=h9II3LmWbVbj0AxjRJnt7K9h-08vMtVsXRCj6Edh3yQ:10:8307157)

    at W4e.initializeView (ej2.min.js?v=h9II3LmWbVbj0AxjRJnt7K9h-08vMtVsXRCj6Edh3yQ:10:8384237)

    at W4e.renderElements (ej2.min.js?v=h9II3LmWbVbj0AxjRJnt7K9h-08vMtVsXRCj6Edh3yQ:10:8377604)

    at W4e.initializeResources (ej2.min.js?v=h9II3LmWbVbj0AxjRJnt7K9h-08vMtVsXRCj6Edh3yQ:10:8377032)

    at W4e.render (ej2.min.js?v=h9II3LmWbVbj0AxjRJnt7K9h-08vMtVsXRCj6Edh3yQ:10:8375892)



Capturar_erro_schedule.PNG


Attachment: WebApplication_net8_5049eb95.zip


3 Replies

VR Vijay Ravi Syncfusion Team June 27, 2025 06:18 AM UTC

Hi Roberto,


You can globalize the Schedule with the other culture by following the steps.


UG:  https://ej2.syncfusion.com/aspnetcore/documentation/schedule/localization
https://ej2.syncfusion.com/javascript/documentation/schedule/frequently-asked-questions#not-processing-culture-files-while-using-localization


We require the below files to localize the Schedule.

  • ca-gregorian.json
  • numbers.json
  • timeZoneNames.json
  • numberingSystems.json


1. You can get the above files by Installing the CLDR-Data package by using the below command.

>> npm install cldr-data –save


Once the installation is completed you can find the files required to localize the Schedule for each culture from the directory as shown below.


you can get ca-gregorian.jsonnumbers.json, and timeZoneNames.json files from the directory as shown below.






You can get the numberingSystems.json file from the directory as shown below. This file is common for all cultures.




2. Now use the loadCultureFiles method to load the culture-specific CLDR JSON data using Ajax as shown in the below code snippet.


[index.cshtml]


function loadCultureFiles(name) {

    var files = ['ca-gregorian.json', 'numberingSystems.json', 'numbers.json', 'timeZoneNames.json'];

    var loader = ej.base.loadCldr;

    var loadCulture = function (prop) {

        var val, ajax;

        if (files[prop] === 'numberingSystems.json') {

            ajax = new ej.base.Ajax(location.origin + '/cldr-data/supplemental/' + files[prop], 'GET', false);

        } else {

            ajax = new ej.base.Ajax(location.origin + '/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);

    }

}

loadCultureFiles('fr-CH');


3. Load the locale words as shown below using the load method of L10n. You can find the localized word for the different cultures from the below repository.


ej2-local:  https://github.com/syncfusion/ej2-locale


[index.cshtml]


var L10n = ej.base.L10n;

L10n.load({

    "pt": {

        "schedule": {

        "day": "Dia",

        "week": "Semana",

        "workWeek": "Semana de trabalho",

        "month": "Mês",

        "year": "Ano",

        "agenda": "Agenda",

        "weekAgenda": "Agenda da semana",

        "workWeekAgenda": "Agenda da Semana de Trabalho",

        "monthAgenda": "Agenda do mês",

        "today": "Hoje",

        "noEvents": "Sem eventos",

        "emptyContainer": "Não há eventos agendados para este dia.",

        "allDay": "Dia todo",

        "start": "Começar",

        "end": "Fim",

        "more": "Mais",

        "close": "Fechar",

        "cancel": "Cancelar",

        "noTitle": "(Sem título)",

        "delete": "Excluir",

        "deleteEvent": "Este evento",

        "deleteMultipleEvent": "Excluir vários eventos",

        "selectedItems": "Itens selecionados",

        "deleteSeries": "Excluir Série",

        "edit": "Editar",

        "editSeries": "Série inteira",

        "editEvent": "Editar Evento",

        "createEvent": "Criar",

        "subject": "Assunto",

        "addTitle": "Adicionar título",

        "moreDetails": "Mais detalhes",

        "moreEvents": "Mais eventos",

        "save": "Salvar",

        "editContent": "Como você gostaria de mudar o compromisso na série?",

        "deleteContent": "Tem certeza de que deseja excluir este evento?",

        "deleteMultipleContent": "Tem certeza de que deseja excluir os eventos selecionados?",

        "newEvent": "Novo evento",

        "title": "Título",

        "location": "Localização",

        "description": "Descrição",

        "timezone": "Fuso horário",

        "startTimezone": "Iniciar fuso horário",

        "endTimezone": "Fuso horário final",

        "repeat": "Repetir",

        "saveButton": "Salvar",

        "cancelButton": "Cancelar",

        "deleteButton": "Excluir",

        "recurrence": "Recorrência",

        "wrongPattern": "O padrão de recorrência não é válido.",

        "seriesChangeAlert": "Deseja cancelar as alterações feitas em instâncias específicas desta série e associá-las à série inteira novamente?",

        "createError": "A duração do evento deve ser menor que a frequência com que ele ocorre. Diminua a duração ou altere o padrão de recorrência no editor de eventos de recorrência.",

        "sameDayAlert": "Duas ocorrências do mesmo evento não podem ocorrer no mesmo dia.",

        "occurenceAlert": "Não é possível reagendar uma ocorrência do compromisso recorrente se ele ignorar uma ocorrência posterior do mesmo compromisso.",

        "editRecurrence": "Editar recorrência",

        "repeats": "Repete",

        "alert": "Alerta",

        "startEndError": "A data final selecionada ocorre antes da data de início.",

        "invalidDateError": "O valor da data inserida é inválido.",

        "blockAlert": "Os eventos não podem ser agendados dentro do intervalo de tempo bloqueado.",

        "ok": "OK",

        "of": "de",

        "yes": "sim",

        "no": "Não",

        "occurrence": "Ocorrência",

        "series": "Series",

        "previous": "Anterior",

        "next": "Próximo",

        "timelineDay": "Dia da linha do tempo",

        "timelineWeek": "Semana da Linha do Tempo",

        "timelineWorkWeek": "Semana de trabalho da linha do tempo",

        "timelineMonth": "Mês da linha do tempo",

        "timelineYear": "Ano da Linha do Tempo",

        "editFollowingEvent": "Eventos seguintes",

        "deleteTitle": "Excluir Evento",

        "editTitle": "Editar evento",

        "beginFrom": "Começar de",

        "endAt": "Termina em",

        "expandAllDaySection": "Seção de expansão para o dia todo",

        "collapseAllDaySection": "Recolher a seção do dia inteiro",

        "searchTimezone": "Pesquisar fuso horário",

        "noRecords": "Nenhum registro encontrado"

    },

    "recurrenceeditor": {

        "none": "Nenhum",

        "daily": "Diariamente",

        "weekly": "Semanal",

        "monthly": "Mensal",

        "month": "Mês",

        "yearly": "Anual",

        "never": "Nunca",

        "until": "Até",

        "count": "Contagem",

        "first": "Primeiro",

        "second": "Segundo",

        "third": "Terceiro",

        "fourth": "Quarto",

        "last": "Último",

        "repeat": "Repetir",

        "repeatEvery": "Repetir a cada",

        "on": "Repetir em",

        "end": "Fim",

        "onDay": "Dia",

        "days": "Dias)",

        "weeks": "Semana (s)",

        "months": "Mês (es)",

        "years": "Ano (es)",

        "every": "cada",

        "summaryTimes": "tempo (s)",

        "summaryOn": "em",

        "summaryUntil": "até",

        "summaryRepeat": "Repete",

        "summaryDay": "dia(es)",

        "summaryWeek": "semana(s)",

        "summaryMonth": "mês (es)",

        "summaryYear": "ano (es)",

        "monthWeek": "Mês Semana",

        "monthPosition": "Posição do mês",

        "monthExpander": "Expansor do mês",

        "yearExpander": "Expansor do ano",

        "repeatInterval": "Intervalo de repetição"

    },

        "calendar": {

            "today": "Hoje"

        },

    }

});


4. Set the locale property to the Schedule.


[index.cshtml]


@using Syncfusion.EJ2.Schedule

 

<ejs-schedule id="schedule" width="100%" height="550px" locale="pt">

    <e-schedule-eventsettings dataSource="@ViewBag.datasource"></e-schedule-eventsettings>

</ejs-schedule>


Don't hesitate to get in touch if you require further help or more information.


Regards,

Vijay


Attachment: ASP_Core_localization_e5d5a842.zip


RO Roberto June 28, 2025 12:25 AM UTC

It´s working


thanks



VR Vijay Ravi Syncfusion Team June 30, 2025 04:07 AM UTC

Hi Roberto,

 

Thanks for your update. We are glad to know that your issue has been resolved. Please get back to us if you need any other assistance.

 

Regards,

Vijay


Loader.
Up arrow icon