Bausteine: slugify mit Umlauten, deutsche Zeit, Sperren

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-09-30 10:21:34 +00:00
1 parent a3faa1aff1
commit 679f996597
6 files changed
+144

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
/**
* Datum und Uhrzeit in der Berliner Zeitzone (beruecksichtigt MESZ/MEZ automatisch),
* fuer Anzeige und Dateinamen. date: 'tt.mm.jjjj', time: 'hhmm' (24h, '0030' statt '2430').
*/
export function berlinDateTime(date = new Date()) {
const parts = new Intl.DateTimeFormat('de-DE', {
timeZone: 'Europe/Berlin',
day: '2-digit',
month: '2-digit',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
hourCycle: 'h23',
}).formatToParts(date)
const value = (type) => parts.find((part) => part.type === type)?.value
return {
date: `${value('day')}.${value('month')}.${value('year')}`,
time: `${value('hour')}${value('minute')}`,
}
}