use correct locale

This commit is contained in:
Jörn-Michael Miehe 2022-09-15 00:40:49 +00:00
parent c58d707f49
commit e4056f3825
2 changed files with 9 additions and 5 deletions

View file

@ -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();

View file

@ -9,8 +9,12 @@ export default class Event {
public constructor(json_data: Record<string, string>) {
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);
}