feat: enhance date formatting in PublicSendPage and SendsPage components

This commit is contained in:
shuaiplus
2026-07-08 19:31:11 +08:00
parent e063f45cd9
commit 04cb475935
3 changed files with 26 additions and 4 deletions
+8 -1
View File
@@ -53,6 +53,13 @@ function asRecord(value: unknown): Record<string, unknown> | null {
return value && typeof value === 'object' ? value as Record<string, unknown> : null;
}
function formatSendDate(value: string | null | undefined): string {
if (!value) return '';
const parsed = new Date(value);
if (Number.isNaN(parsed.getTime())) return '';
return parsed.toLocaleString();
}
function optionalString(value: unknown): string | null {
return typeof value === 'string' ? value : null;
}
@@ -283,7 +290,7 @@ export default function PublicSendPage(props: PublicSendPageProps) {
</button>
</div>
)}
{!!sendData.expirationDate && <p className="muted">{t('txt_expires_at_value', { value: sendData.expirationDate })}</p>}
{!!sendData.expirationDate && <p className="muted">{t('txt_expires_at_value', { value: formatSendDate(sendData.expirationDate) })}</p>}
</>
)}