diff --git a/apps/mini-user/src/pages/redeem-success/index.tsx b/apps/mini-user/src/pages/redeem-success/index.tsx index 0a336f4..54a41a2 100644 --- a/apps/mini-user/src/pages/redeem-success/index.tsx +++ b/apps/mini-user/src/pages/redeem-success/index.tsx @@ -20,27 +20,23 @@ function formatMoney(amount: number) { return amount.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }); } -/** 中国时区展示:2026年8月3日 13点45分 */ +/** 与权益「历史记录」一致:2026-08-03 13:53:03(Asia/Shanghai) */ function formatChinaDateTime(input?: string | null) { const d = input ? new Date(input) : new Date(); if (Number.isNaN(d.getTime())) return '—'; - const parts = new Intl.DateTimeFormat('zh-CN', { + const parts = new Intl.DateTimeFormat('en-CA', { timeZone: 'Asia/Shanghai', year: 'numeric', - month: 'numeric', - day: 'numeric', - hour: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', minute: '2-digit', + second: '2-digit', hour12: false, }).formatToParts(d); const get = (type: Intl.DateTimeFormatPartTypes) => parts.find((p) => p.type === type)?.value ?? ''; - const year = get('year'); - const month = String(Number(get('month'))); - const day = String(Number(get('day'))); - const hour = String(Number(get('hour'))); - const minute = get('minute').padStart(2, '0'); - return `${year}年${month}月${day}日 ${hour}点${minute}分`; + return `${get('year')}-${get('month')}-${get('day')} ${get('hour')}:${get('minute')}:${get('second')}`; } function StarRating({