diff --git a/web/index.html b/web/index.html
index f762d79..a246f8a 100644
--- a/web/index.html
+++ b/web/index.html
@@ -1575,8 +1575,7 @@
|
|
|
- |
- |
+ |
|
|
|
diff --git a/web/trade-fairs.js b/web/trade-fairs.js
index 5f52622..830d96b 100644
--- a/web/trade-fairs.js
+++ b/web/trade-fairs.js
@@ -24,8 +24,7 @@
'thema',
'stadt',
'bundesland',
- 'termin_start',
- 'termin_ende',
+ 'termin',
'besucher',
'besucher_jahr',
'besucher_status',
@@ -706,8 +705,7 @@
thema: 'text',
stadt: 'text',
bundesland: 'text',
- termin_start: 'date',
- termin_ende: 'date',
+ termin: 'date',
besucher: 'number',
besucher_jahr: 'number',
besucher_status: 'text',
@@ -763,7 +761,8 @@
return {
...row,
tage_bis_start: getDaysUntil(row.termin_start),
- zuletzt_gesucht_am: lastOpenedByTradeFair[getTradeFairOpenKey(row)] || null
+ zuletzt_gesucht_am: lastOpenedByTradeFair[getTradeFairOpenKey(row)] || null,
+ termin: row.termin_start || null
};
}
@@ -806,6 +805,40 @@
return date.toLocaleDateString('de-DE');
}
+ function formatTermRange(startIso, endIso) {
+ const start = toDate(startIso);
+ const end = toDate(endIso);
+
+ if (!start && !end) {
+ return 'k.A.';
+ }
+ if (start && !end) {
+ return formatDate(startIso);
+ }
+ if (!start && end) {
+ return formatDate(endIso);
+ }
+
+ const startDay = start.getDate();
+ const startMonth = start.getMonth() + 1;
+ const startYear = start.getFullYear();
+ const endDay = end.getDate();
+ const endMonth = end.getMonth() + 1;
+ const endYear = end.getFullYear();
+
+ if (startYear === endYear) {
+ if (startMonth === endMonth) {
+ if (startDay === endDay) {
+ return `${startDay}.${startMonth}.${startYear}`;
+ }
+ return `${startDay}.-${endDay}.${startMonth}.${startYear}`;
+ }
+ return `${startDay}.${startMonth}.-${endDay}.${endMonth}.${startYear}`;
+ }
+
+ return `${startDay}.${startMonth}.${startYear}-${endDay}.${endMonth}.${endYear}`;
+ }
+
function matchesSearch(row, term) {
if (!term) {
return true;
@@ -1523,8 +1556,7 @@
thema: createCell(row.thema, 'thema'),
stadt: createCell(row.stadt, 'stadt'),
bundesland: createCell(row.bundesland, 'bundesland'),
- termin_start: createCell(formatDate(row.termin_start), 'termin_start'),
- termin_ende: createCell(formatDate(row.termin_ende), 'termin_ende'),
+ termin: createCell(formatTermRange(row.termin_start, row.termin_ende), 'termin'),
besucher: createCell(formatNumber(row.besucher), 'besucher'),
besucher_jahr: createCell(formatNumber(row.besucher_jahr), 'besucher_jahr'),
besucher_status: createCell(row.besucher_status, 'besucher_status'),