From e4056f3825922371221a916665b2966b343f939e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Thu, 15 Sep 2022 00:40:49 +0000 Subject: [PATCH] use correct locale --- ui/src/components/calendar/EventItem.vue | 6 +++--- ui/src/components/calendar/event.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ui/src/components/calendar/EventItem.vue b/ui/src/components/calendar/EventItem.vue index a33e9b8..8c7537b 100644 --- a/ui/src/components/calendar/EventItem.vue +++ b/ui/src/components/calendar/EventItem.vue @@ -42,9 +42,9 @@ export default class EventItem extends Vue { private readonly event!: Event; private get data_string(): string { - const locale_string = this.event.start - .setLocale(navigator.language) - .toLocaleString(DateTime.DATETIME_MED); + const locale_string = this.event.start.toLocaleString( + DateTime.DATETIME_MED_WITH_WEEKDAY + ); // TODO: if applicable, include days and/or minutes. const duration_string = this.event.duration.shiftTo("hours").toHuman(); diff --git a/ui/src/components/calendar/event.ts b/ui/src/components/calendar/event.ts index be016cf..f2536c1 100644 --- a/ui/src/components/calendar/event.ts +++ b/ui/src/components/calendar/event.ts @@ -9,8 +9,12 @@ export default class Event { 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.start = DateTime + .fromISO(json_data["dtstart"]) + .setLocale(navigator.language); + const end = DateTime + .fromISO(json_data["dtend"]) + .setLocale(navigator.language); this.duration = end.diff(this.start); }