Set the right locale to the fullcalendar instances

This commit is contained in:
Alex Tselegidis 2023-07-17 07:50:55 +02:00
parent 5e260c7cfd
commit 0bb02ae2bf
4 changed files with 12 additions and 8 deletions

View file

@ -132,6 +132,8 @@ class EA_Controller extends CI_Controller {
'index_page' => config('index_page'), 'index_page' => config('index_page'),
'available_languages' => config('available_languages'), 'available_languages' => config('available_languages'),
'csrf_token' => $this->security->get_csrf_hash(), 'csrf_token' => $this->security->get_csrf_hash(),
'language' => config('language'),
'language_code' => config('language_code'),
]); ]);
} }

View file

@ -45,6 +45,14 @@ window.App = (function () {
} }
$(document).ajaxError(onAjaxError); $(document).ajaxError(onAjaxError);
$(function() {
if (window.moment) {
window.moment.locale(vars('language_code'));
}
})
return { return {
Components: {}, Components: {},

View file

@ -1448,6 +1448,7 @@ App.Utils.CalendarDefaultView = (function () {
// Initialize page calendar // Initialize page calendar
fullCalendar = new FullCalendar.Calendar($calendar[0], { fullCalendar = new FullCalendar.Calendar($calendar[0], {
initialView, initialView,
locale: vars('language_code'),
nowIndicator: true, nowIndicator: true,
height: getCalendarHeight(), height: getCalendarHeight(),
editable: true, editable: true,
@ -1461,14 +1462,6 @@ App.Utils.CalendarDefaultView = (function () {
eventColor: '#7cbae8', eventColor: '#7cbae8',
slotLabelFormat: slotTimeFormat, slotLabelFormat: slotTimeFormat,
allDayContent: lang('all_day'), allDayContent: lang('all_day'),
views: {
timeGridDay: {
dayHeaderFormat: columnFormat
},
timeGridWeek: {
dayHeaderFormat: columnFormat
}
},
selectable: true, selectable: true,
selectMirror: true, selectMirror: true,
themeSystem: 'bootstrap5', themeSystem: 'bootstrap5',

View file

@ -676,6 +676,7 @@ App.Utils.CalendarTableView = (function () {
const firstWeekdayNumber = App.Utils.Date.getWeekdayId(firstWeekday); const firstWeekdayNumber = App.Utils.Date.getWeekdayId(firstWeekday);
const fullCalendar = new FullCalendar.Calendar($wrapper[0], { const fullCalendar = new FullCalendar.Calendar($wrapper[0], {
locale: vars('language_code'),
initialView: 'timeGridDay', initialView: 'timeGridDay',
nowIndicator: true, nowIndicator: true,
height: getCalendarHeight(), height: getCalendarHeight(),