minor fix pandora_enterprise#3943

This commit is contained in:
Daniel Barbero Martin 2022-02-04 09:48:10 +01:00
parent c971ed6dd5
commit 6f15d26af2

View File

@ -417,49 +417,51 @@ function loadEventBBDD(events) {
Object.entries(JSON.parse(events)).forEach(function(element) { Object.entries(JSON.parse(events)).forEach(function(element) {
var day_string = element[0]; var day_string = element[0];
var events_day = element[1]; var events_day = element[1];
events_day.forEach(function(event) { if (events_day != "" && events_day != null && events_day != undefined) {
if (event != null) { events_day.forEach(function(event) {
var time_from = event.start.split(":"); if (event != null) {
var time_to = event.end.split(":"); var time_from = event.start.split(":");
var time_to = event.end.split(":");
var start = dates[day_string].setHours( var start = dates[day_string].setHours(
time_from[0], time_from[0],
time_from[1], time_from[1],
time_from[2], time_from[2],
0 0
); );
var end = dates[day_string].setHours( var end = dates[day_string].setHours(
time_to[0],
time_to[1],
time_to[2],
0
);
if (event.end === "00:00:00") {
end = dates[day_names[keys_days_names[day_string] + 1]].setHours(
time_to[0], time_to[0],
time_to[1], time_to[1],
time_to[2], time_to[2],
0 0
); );
} if (event.end === "00:00:00") {
end = dates[day_names[keys_days_names[day_string] + 1]].setHours(
time_to[0],
time_to[1],
time_to[2],
0
);
}
var title = ""; var title = "";
if ( if (
time_format(start) === "00:00:00" && time_format(start) === "00:00:00" &&
time_format(end) === "00:00:00" time_format(end) === "00:00:00"
) { ) {
title = "All day"; title = "All day";
} }
result.push({ result.push({
title: title, title: title,
start: start, start: start,
end: end, end: end,
id: uniqId() id: uniqId()
}); });
} }
}); });
}
}); });
return result; return result;