fix(c2c-bot): 水单完成时间转换为北京时间 (UTC+8)

问题:水单上的完成时间显示 UTC 时间(如 03:38:40),实际北京时间为 11:38:40。
原因:toISOString() 始终返回 UTC 时间。
修复:手动加 8 小时偏移量,将 UTC 转换为北京时间后再格式化。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-02 19:42:13 -08:00
parent bf11a269a4
commit 14e70b56bb
1 changed files with 3 additions and 1 deletions

View File

@ -40,7 +40,9 @@ export class PaymentProofService {
}
private buildSvg(data: ProofData): string {
const time = data.completedAt.toISOString().replace('T', ' ').slice(0, 19);
// toISOString() 返回 UTC手动加 8 小时转北京时间
const beijingDate = new Date(data.completedAt.getTime() + 8 * 60 * 60 * 1000);
const time = beijingDate.toISOString().replace('T', ' ').slice(0, 19);
return `<svg xmlns="http://www.w3.org/2000/svg" width="600" height="420">
<defs>