fix: replace hardcoded Uhr suffix and use getLocale() in budget
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
import { api } from '/api.js';
|
||||
import { openModal as openSharedModal, closeModal } from '/components/modal.js';
|
||||
import { stagger, vibrate } from '/utils/ux.js';
|
||||
import { t, formatDate } from '/i18n.js';
|
||||
import { t, formatDate, getLocale } from '/i18n.js';
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Konstanten
|
||||
@@ -34,7 +34,7 @@ const CATEGORY_LABELS = () => ({
|
||||
function getMonthName(monthIndex) {
|
||||
// monthIndex: 0-based (0=Januar, 11=Dezember)
|
||||
const date = new Date(2000, monthIndex, 1);
|
||||
return new Intl.DateTimeFormat(document.documentElement.lang || 'de', { month: 'long' }).format(date);
|
||||
return new Intl.DateTimeFormat(getLocale(), { month: 'long' }).format(date);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
@@ -665,7 +665,7 @@ function showEventPopup(ev, anchor) {
|
||||
const timeStr = ev.all_day
|
||||
? t('calendar.allDay')
|
||||
: formatDateTime(ev.start_datetime)
|
||||
+ (ev.end_datetime ? ` – ${formatTime(ev.end_datetime)} Uhr` : '');
|
||||
+ (ev.end_datetime ? ` – ${formatTime(ev.end_datetime)}${t('calendar.timeSuffix') ? ' ' + t('calendar.timeSuffix') : ''}`.trim() : '');
|
||||
|
||||
popup.innerHTML = `
|
||||
<div class="event-popup__color-bar" style="background-color:${escHtml(ev.color)};"></div>
|
||||
|
||||
@@ -35,7 +35,8 @@ function formatDateTime(isoString) {
|
||||
: formatDate(d);
|
||||
|
||||
const timeStr = formatTime(d);
|
||||
return `${dateStr}, ${timeStr} Uhr`;
|
||||
const suffix = t('calendar.timeSuffix');
|
||||
return `${dateStr}, ${timeStr}${suffix ? ' ' + suffix : ''}`.trim();
|
||||
}
|
||||
|
||||
function formatDueDate(dateStr) {
|
||||
@@ -191,7 +192,8 @@ function renderUpcomingEvents(events) {
|
||||
const items = events.map((e) => {
|
||||
const d = new Date(e.start_datetime);
|
||||
const isToday = d.toDateString() === today;
|
||||
const timeStr = e.all_day ? t('dashboard.allDay') : formatTime(d) + ' Uhr';
|
||||
const _suffix = t('calendar.timeSuffix');
|
||||
const timeStr = e.all_day ? t('dashboard.allDay') : `${formatTime(d)}${_suffix ? ' ' + _suffix : ''}`.trim();
|
||||
return `
|
||||
<div class="event-item" data-route="/calendar" role="button" tabindex="0">
|
||||
<div class="event-item__bar" style="background-color:${e.color || 'var(--color-accent)'}"></div>
|
||||
|
||||
Reference in New Issue
Block a user