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 readonly event!: Event;
private get data_string(): string { private get data_string(): string {
const locale_string = this.event.start const locale_string = this.event.start.toLocaleString(
.setLocale(navigator.language) DateTime.DATETIME_MED_WITH_WEEKDAY
.toLocaleString(DateTime.DATETIME_MED); );
// TODO: if applicable, include days and/or minutes. // TODO: if applicable, include days and/or minutes.
const duration_string = this.event.duration.shiftTo("hours").toHuman(); 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>) { public constructor(json_data: Record<string, string>) {
this.summary = json_data["summary"]; this.summary = json_data["summary"];
this.description = json_data["description"]; this.description = json_data["description"];
this.start = DateTime.fromISO(json_data["dtstart"]); this.start = DateTime
const end = DateTime.fromISO(json_data["dtend"]); .fromISO(json_data["dtstart"])
.setLocale(navigator.language);
const end = DateTime
.fromISO(json_data["dtend"])
.setLocale(navigator.language);
this.duration = end.diff(this.start); this.duration = end.diff(this.start);
} }