From 1caccb731a135ca72671833fb15f0d7623f01f2e Mon Sep 17 00:00:00 2001 From: alext Date: Thu, 8 Mar 2018 14:55:51 +0100 Subject: [PATCH] Changed the time formatting in javascript files. --- .../js/backend_calendar_appointments_modal.js | 4 ++-- .../js/backend_calendar_default_view.js | 4 ++-- ...backend_calendar_unavailabilities_modal.js | 4 ++-- src/assets/js/general_functions.js | 5 +++-- src/assets/js/working_plan.js | 22 +++++++++---------- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/assets/js/backend_calendar_appointments_modal.js b/src/assets/js/backend_calendar_appointments_modal.js index 20393e48..6fbf2a5b 100755 --- a/src/assets/js/backend_calendar_appointments_modal.js +++ b/src/assets/js/backend_calendar_appointments_modal.js @@ -391,7 +391,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa $dialog.find('#start-datetime').datetimepicker({ dateFormat: dateFormat, - timeFormat: (GlobalVariables.timeFormat === 'h:mm tt') ? 'h:mm TT' : GlobalVariables.timeFormat, + timeFormat: GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : GlobalVariables.timeFormat, // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, @@ -421,7 +421,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa $dialog.find('#end-datetime').datetimepicker({ dateFormat: dateFormat, - timeFormat: (GlobalVariables.timeFormat === 'h:mm tt') ? 'h:mm TT' : GlobalVariables.timeFormat, + timeFormat: GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : GlobalVariables.timeFormat, // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, diff --git a/src/assets/js/backend_calendar_default_view.js b/src/assets/js/backend_calendar_default_view.js index dcd74838..f038ff42 100755 --- a/src/assets/js/backend_calendar_default_view.js +++ b/src/assets/js/backend_calendar_default_view.js @@ -1067,11 +1067,11 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; var slotTimeFormat= ''; switch (GlobalVariables.timeFormat) { - case 'HH:mm': + case 'military': timeFormat = 'H:mm'; slotTimeFormat = 'H(:mm)'; break; - case 'h:mm tt': + case 'regular': timeFormat = 'h:mm A'; slotTimeFormat = 'h(:mm) A'; break; diff --git a/src/assets/js/backend_calendar_unavailabilities_modal.js b/src/assets/js/backend_calendar_unavailabilities_modal.js index 73976f85..7c34024d 100755 --- a/src/assets/js/backend_calendar_unavailabilities_modal.js +++ b/src/assets/js/backend_calendar_unavailabilities_modal.js @@ -183,7 +183,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili $dialog.find('#unavailable-start').datetimepicker({ dateFormat: dateFormat, - timeFormat: (GlobalVariables.timeFormat === 'h:mm tt') ? 'h:mm TT' : GlobalVariables.timeFormat, + timeFormat: GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : GlobalVariables.timeFormat, // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, @@ -213,7 +213,7 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili $dialog.find('#unavailable-end').datetimepicker({ dateFormat: dateFormat, - timeFormat: (GlobalVariables.timeFormat === 'h:mm tt') ? 'h:mm TT' : GlobalVariables.timeFormat, + timeFormat: GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : GlobalVariables.timeFormat, // Translation dayNames: [EALang.sunday, EALang.monday, EALang.tuesday, EALang.wednesday, diff --git a/src/assets/js/general_functions.js b/src/assets/js/general_functions.js index a20558f7..fc396eb5 100755 --- a/src/assets/js/general_functions.js +++ b/src/assets/js/general_functions.js @@ -410,8 +410,9 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * @return {String} Returns the formatted date string. */ exports.formatDate = function (date, dateFormatSetting, addHours) { - var format, result; - var hours = addHours ? ' ' + GlobalVariables.timeFormat : ''; + var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm'; + var hours = addHours ? ' ' + timeFormat : ''; + var result; switch (dateFormatSetting) { case 'DMY': diff --git a/src/assets/js/working_plan.js b/src/assets/js/working_plan.js index df39fae6..b7530037 100755 --- a/src/assets/js/working_plan.js +++ b/src/assets/js/working_plan.js @@ -48,8 +48,8 @@ $.each(workingPlan, function (index, workingDay) { if (workingDay != null) { $('#' + index).prop('checked', true); - $('#' + index + '-start').val(Date.parse(workingDay.start).toString(GlobalVariables.timeFormat).toUpperCase()); - $('#' + index + '-end').val(Date.parse(workingDay.end).toString(GlobalVariables.timeFormat).toUpperCase()); + $('#' + index + '-start').val(Date.parse(workingDay.start).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase()); + $('#' + index + '-end').val(Date.parse(workingDay.end).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase()); // Add the day's breaks on the breaks table. $.each(workingDay.breaks, function (i, brk) { @@ -58,8 +58,8 @@ var tr = '' + '' + GeneralFunctions.ucaseFirstLetter(day) + '' + - '' + Date.parse(brk.start).toString(GlobalVariables.timeFormat).toUpperCase() + '' + - '' + Date.parse(brk.end).toString(GlobalVariables.timeFormat).toUpperCase() + '' + + '' + Date.parse(brk.start).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase() + '' + + '' + Date.parse(brk.end).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase() + '' + '' + '