fix rectification PostgreSQL birth dates

This commit is contained in:
Jesse_Chen
2026-08-03 17:28:26 +08:00
parent dc574eb11a
commit 9523ad23e8
4 changed files with 14 additions and 3 deletions
@@ -64,6 +64,9 @@ export function parseBirthDate(value: string): Date | undefined {
}
export function normalizePersistedBirthDate(value: unknown): string {
if (value instanceof Date) {
return Number.isNaN(value.getTime()) ? "" : value.toISOString().slice(0, 10);
}
if (typeof value !== "string") return "";
const persisted = value.trim();
const date = persisted.slice(0, 10);