From 41d3e9088ec4ddd98778e91dcc46d4bda84b445f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?=
<40151420+ldericher@users.noreply.github.com>
Date: Wed, 14 Sep 2022 23:04:26 +0000
Subject: [PATCH] EventItem better formatting
---
ui/src/components/Calendar.vue | 45 +++---------------
ui/src/components/calendar/EventItem.vue | 60 ++++++++++++++++++++++++
ui/src/components/calendar/event.ts | 17 +++++++
3 files changed, 83 insertions(+), 39 deletions(-)
create mode 100644 ui/src/components/calendar/EventItem.vue
create mode 100644 ui/src/components/calendar/event.ts
diff --git a/ui/src/components/Calendar.vue b/ui/src/components/Calendar.vue
index 2102b27..dc61d17 100644
--- a/ui/src/components/Calendar.vue
+++ b/ui/src/components/Calendar.vue
@@ -1,50 +1,17 @@
-
-
- {{ event.start.toFormat("dd") }}.
- {{ event.start.toFormat("MM") }}.
-
- {{ event.summary }}
-
- {{ event.description }}
-
-
- {{ event.start | locale_string }}
- ({{ event.duration | duration_string }})
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/ui/src/components/calendar/event.ts b/ui/src/components/calendar/event.ts
new file mode 100644
index 0000000..39eca76
--- /dev/null
+++ b/ui/src/components/calendar/event.ts
@@ -0,0 +1,17 @@
+import { DateTime, Duration } from "luxon";
+
+export default class Event {
+ public summary: string;
+ public description: string;
+ public start: DateTime;
+ public duration: Duration;
+
+ public constructor(json_data: Record) {
+ this.summary = json_data["summary"];
+ this.description = json_data["description"];
+ this.start = DateTime.fromISO(json_data["dtstart"]);
+ const end = DateTime.fromISO(json_data["dtend"]);
+
+ this.duration = end.diff(this.start);
+ }
+}
\ No newline at end of file