Phase 0.3: migrate date formatting to date-fns

This commit is contained in:
Agent Zero
2026-07-23 05:05:08 +02:00
parent 241850fddd
commit 57d18c1381
20 changed files with 133 additions and 56 deletions
+3 -2
View File
@@ -438,13 +438,14 @@ export function decodeMimeHeader(value: string | undefined | null): string {
* Variables: {{user.name}}, {{user.first_name}}, {{user.last_name}},
* {{user.email}}, {{user.role}}, {{tenant.name}}, {{date}}
*/
import { formatDateShort } from '@/utils/date';
export function replaceSignatureVariables(
html: string,
user: { name?: string; email?: string; role?: string; first_name?: string; last_name?: string },
tenant?: { name?: string },
): string {
const now = new Date();
const dateStr = now.toLocaleDateString([], { year: 'numeric', month: '2-digit', day: '2-digit' });
const dateStr = formatDateShort(new Date());
const firstName = user.first_name || (user.name ? user.name.split(' ')[0] : '');
const lastName = user.last_name || (user.name ? user.name.split(' ').slice(1).join(' ') : '');