Skip to content

Commit 9036138

Browse files
committed
Ensure unique iCalendar UIDs for events starting at the same time
1 parent 016a5f0 commit 9036138

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

static/calendar.ics

+11-2
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,28 @@ DTSTART:19701025T030000
2323
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
2424
END:STANDARD
2525
END:VTIMEZONE
26+
{% assign uids = "" -%}
2627
{% for termin in site.data.calendar -%}
2728
{% assign start_date = termin.datum | append: " " | append: termin.uhrzeit | remove: "h" | replace: ".", ":" | date: '%s' -%}
29+
{% assign start = start_date | date: '%Y%m%dT%H%M%S' -%}
30+
{% if uids contains start -%}
31+
{% assign uidaddition = termin.ort | url_encode -%}
32+
{% assign uid = start | append: uidaddition -%}
33+
{% else -%}
34+
{% assign uid = start -%}
35+
{% endif -%}
36+
{% assign uids = uids | append: "," | append: uid -%}
2837
{% if termin.dauer -%}
2938
{% assign dauer_seconds = termin.dauer | times: 3600 -%}
3039
{% else -%}
3140
{% assign dauer_seconds = 3600 -%}
3241
{% endif -%}
3342
{% assign end = start_date | plus: dauer_seconds | round | date: '%Y%m%dT%H%M%S' -%}
3443
BEGIN:VEVENT
35-
UID:meeting+{{ start_date | date: '%Y%m%dT%H%M%S' }}@techaachen.de
44+
UID:meeting+{{ uid }}@techaachen.de
3645
SUMMARY:TechAachen - {{ termin.title }}
3746
LOCATION:{{ termin.ort }}
38-
DTSTART;TZID=Europe/Berlin:{{ start_date | date: '%Y%m%dT%H%M%S' }}
47+
DTSTART;TZID=Europe/Berlin:{{ start }}
3948
DTEND;TZID=Europe/Berlin:{{ end }}
4049
DTSTAMP:{{ site.time | date: '%Y%m%dT%H%M%SZ' }}
4150
END:VEVENT

0 commit comments

Comments
 (0)