remove vars with duplicate values

This commit is contained in:
Stefan Bühler 2025-01-24 18:09:05 +01:00
parent 52fe090a53
commit f5a30013e3

View File

@ -87,24 +87,21 @@ function display_event_date(item) {
if (start_time === "00:00" && end_time === "00:00") { if (start_time === "00:00" && end_time === "00:00") {
// localtime "all-day" event // localtime "all-day" event
const end_day = new Date(end.valueOf()); if (start_date === end_date) {
const end_day_date = fmt_date.format(end_day);
if (start_date === end_day_date) {
return display_date_local(start, start_date); return display_date_local(start, start_date);
} else { } else {
return m("span.timerange", display_date_local(start, start_date), " - ", display_date_local(end_day, end_day_date)); return m("span.timerange", display_date_local(start, start_date), " - ", display_date_local(end, end_date));
} }
} }
if (start.getUTCHours() === 0 && start.getUTCMinutes() === 0 && end.getUTCHours() === 0 && end.getUTCMinutes() === 0) { if (start.getUTCHours() === 0 && start.getUTCMinutes() === 0 && end.getUTCHours() === 0 && end.getUTCMinutes() === 0) {
// UTC "all-day" event // UTC "all-day" event
const end_day = new Date(end.valueOf());
const utc_start_date = fmt_date_utc.format(start); const utc_start_date = fmt_date_utc.format(start);
const utc_end_day_date = fmt_date_utc.format(end_day); const utc_end_day_date = fmt_date_utc.format(end);
if (utc_start_date === utc_end_day_date) { if (utc_start_date === utc_end_day_date) {
return display_date_utc(start, utc_start_date); return display_date_utc(start, utc_start_date);
} else { } else {
return m("span.timerange", display_date_utc(start, utc_start_date), " - ", display_date_utc(end_day, utc_end_day_date)); return m("span.timerange", display_date_utc(start, utc_start_date), " - ", display_date_utc(end, utc_end_day_date));
} }
} }