diff options
author | Alban Gruin | 2020-12-30 17:40:57 +0100 |
---|---|---|
committer | Alban Gruin | 2020-12-30 17:40:57 +0100 |
commit | 3e9d3b3437f2d63a47f9c962ba9187c5ef692328 (patch) | |
tree | 8b1f5e122ac9caeff3f56849a516e7b10d788d80 /src/ics.ml | |
parent | 8dff924f4d598da653794e29fb9929017e161aa3 (diff) |
ics: print the timezone name in the ICS file
Add the correct timezone in generated ICS files. The timezone is
fetched from /etc/timezone.
Even though this is not standard, if a tool needs it, it should be able
to understand it correctly.
Signed-off-by: Alban Gruin <alban at pa1ch dot fr>
Diffstat (limited to 'src/ics.ml')
-rw-r--r-- | src/ics.ml | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -61,8 +61,19 @@ type t = Event.t list let make events = events -let to_string events = +let gen_vtimezone tz = + if tz <> "" then + ["BEGIN:VTIMEZONE"; + "TZID:" ^ tz; + "END:VTIMEZONE\n"] + |> List.map ics_split_line + |> String.concat "\n" + else + "" + +let to_string tz events = let date = current_date () in + let vtimezone = gen_vtimezone tz in let rec gen_events id str = function | [] -> str | event :: l -> @@ -70,5 +81,6 @@ let to_string events = "BEGIN:VCALENDAR\n\ VERSION:2.0\n\ PRODID:-//ucs//\n" + ^ vtimezone ^ gen_events 0 "" events ^ "END:VCALENDAR\n" |