split javascript file into multiple

This commit is contained in:
2026-09-21 21:25:31 +02:00
parent b09f2029ed
commit cc91f7d4ff
17 changed files with 473 additions and 461 deletions
+19
View File
@@ -0,0 +1,19 @@
export function formatDate(date, locale) {
const dateObj = new Date(date);
if (isNaN(dateObj.getTime())) {
return date;
}
return new Intl.DateTimeFormat(locale || "de-DE", {
dateStyle: "medium"
}).format(dateObj);
}
// "from <start> to <end>", with the wording taken from the language file.
export function formatDateRange(item) {
const startDate = formatDate(item.start, item.locale);
const endDate = formatDate(item.end, item.locale);
return item.from + "\n" + startDate + "\n" + item.to + "\n" + endDate;
}