feat: add getBaseUrl function for consistent base URL generation across routes
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m28s

feat(calendar): display local timezone in calendar view
feat(i18n): add timezone label to German and English translations
This commit is contained in:
2026-03-04 09:44:02 +01:00
parent 61274d31f1
commit 43d94181f9
11 changed files with 54 additions and 28 deletions

View File

@@ -507,6 +507,7 @@
"linkedRoom": "Verknüpfter Raum",
"noRoom": "Kein Raum (kein Videomeeting)",
"linkedRoomHint": "Verknüpfe einen Raum, um die Beitritts-URL automatisch ins Event einzufügen.",
"timezone": "Zeitzone",
"color": "Farbe",
"eventCreated": "Event erstellt!",
"eventUpdated": "Event aktualisiert!",

View File

@@ -507,6 +507,7 @@
"linkedRoom": "Linked Room",
"noRoom": "No room (no video meeting)",
"linkedRoomHint": "Link a room to automatically include the join-URL in the event.",
"timezone": "Timezone",
"color": "Color",
"eventCreated": "Event created!",
"eventUpdated": "Event updated!",

View File

@@ -554,6 +554,9 @@ export default function Calendar() {
/>
</div>
</div>
<p className="text-xs text-th-text-s -mt-2">
{t('calendar.timezone')}: {getLocalTimezone()}
</p>
<div>
<label className="block text-sm font-medium text-th-text mb-1.5">{t('calendar.linkedRoom')}</label>
@@ -606,6 +609,7 @@ export default function Calendar() {
<span>
{new Date(showDetail.start_time).toLocaleString()} - {new Date(showDetail.end_time).toLocaleString()}
</span>
<span className="text-xs opacity-70">({getLocalTimezone()})</span>
</div>
{showDetail.description && (
@@ -846,3 +850,15 @@ function formatTime(dateStr) {
const d = new Date(dateStr);
return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
}
function getLocalTimezone() {
try {
return Intl.DateTimeFormat().resolvedOptions().timeZone;
} catch {
const offset = -new Date().getTimezoneOffset();
const sign = offset >= 0 ? '+' : '-';
const h = String(Math.floor(Math.abs(offset) / 60)).padStart(2, '0');
const m = String(Math.abs(offset) % 60).padStart(2, '0');
return `UTC${sign}${h}:${m}`;
}
}