Parse the working plan start and end value correctly, depending on the current time format setting.

This commit is contained in:
Alex Tselegidis 2022-01-17 21:32:44 +01:00
parent 2feb0d5c99
commit 0cf99d9538

View file

@ -629,13 +629,15 @@ App.Utils.WorkingPlan = (function () {
get() {
const workingPlan = {};
const timeFormat = App.Vars.time_format === 'regular' ? 'h:mm a' : 'HH:mm';
$('.working-plan input:checkbox').each(
function (index, checkbox) {
const id = $(checkbox).attr('id');
if ($(checkbox).prop('checked') === true) {
workingPlan[id] = {
start: moment($('#' + id + '-start').val(), 'HH:mm').format('HH:mm'),
end: moment($('#' + id + '-end').val(), 'HH:mm').format('HH:mm'),
start: moment($('#' + id + '-start').val(), timeFormat).format('HH:mm'),
end: moment($('#' + id + '-end').val(), timeFormat).format('HH:mm'),
breaks: []
};