feat: Convert email date format from American to European (dd.mm.yyyy)

- Add formatDateGerman() helper function to convert yyyy-mm-dd to dd.mm.yyyy
- Update all email templates (HTML and text versions) to use European date format
- Apply formatting to booking pending, confirmed, and cancelled emails
- Ensure consistent date display across all customer communications
- Improve user experience with familiar German date format

Changes:
- email-templates.ts: Add date formatting to all HTML templates
- bookings.ts: Add date formatting to all text email versions
- Both files: Consistent European date format (dd.mm.yyyy) throughout
This commit is contained in:
2025-09-30 11:42:41 +02:00
parent a1935aae02
commit aeb32da6c2
4 changed files with 60 additions and 7 deletions

View File

@@ -2,6 +2,12 @@ import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
// Helper function to convert date from yyyy-mm-dd to dd.mm.yyyy
function formatDateGerman(dateString: string): string {
const [year, month, day] = dateString.split('-');
return `${day}.${month}.${year}`;
}
let cachedLogoDataUrl: string | null = null;
async function getLogoDataUrl(): Promise<string | null> {
@@ -47,9 +53,10 @@ async function renderBrandedEmail(title: string, bodyHtml: string): Promise<stri
export async function renderBookingPendingHTML(params: { name: string; date: string; time: string }) {
const { name, date, time } = params;
const formattedDate = formatDateGerman(date);
const inner = `
<p>Hallo ${name},</p>
<p>wir haben deine Anfrage für <strong>${date}</strong> um <strong>${time}</strong> erhalten.</p>
<p>wir haben deine Anfrage für <strong>${formattedDate}</strong> um <strong>${time}</strong> erhalten.</p>
<p>Wir bestätigen deinen Termin in Kürze. Du erhältst eine weitere E-Mail, sobald der Termin bestätigt ist.</p>
<p>Liebe Grüße,<br/>Stargirlnails Kiel</p>
`;
@@ -58,9 +65,10 @@ export async function renderBookingPendingHTML(params: { name: string; date: str
export async function renderBookingConfirmedHTML(params: { name: string; date: string; time: string }) {
const { name, date, time } = params;
const formattedDate = formatDateGerman(date);
const inner = `
<p>Hallo ${name},</p>
<p>wir haben deinen Termin am <strong>${date}</strong> um <strong>${time}</strong> bestätigt.</p>
<p>wir haben deinen Termin am <strong>${formattedDate}</strong> um <strong>${time}</strong> bestätigt.</p>
<p>Wir freuen uns auf dich!</p>
<div style="background-color: #f8fafc; border-left: 4px solid #db2777; padding: 16px; margin: 20px 0; border-radius: 4px;">
<p style="margin: 0; font-weight: 600; color: #db2777;">📋 Wichtiger Hinweis:</p>
@@ -73,9 +81,10 @@ export async function renderBookingConfirmedHTML(params: { name: string; date: s
export async function renderBookingCancelledHTML(params: { name: string; date: string; time: string }) {
const { name, date, time } = params;
const formattedDate = formatDateGerman(date);
const inner = `
<p>Hallo ${name},</p>
<p>dein Termin am <strong>${date}</strong> um <strong>${time}</strong> wurde abgesagt.</p>
<p>dein Termin am <strong>${formattedDate}</strong> um <strong>${time}</strong> wurde abgesagt.</p>
<p>Bitte buche einen neuen Termin. Bei Fragen helfen wir dir gerne weiter.</p>
<p>Liebe Grüße,<br/>Stargirlnails Kiel</p>
`;