feat(docker): 安装 tzdata 并设置 TZ=Asia/Shanghai 以让 Node.js 使用上海时区

This commit is contained in:
2025-08-02 10:42:43 +08:00
parent a96aa6e073
commit e936fbc140
8 changed files with 32 additions and 21 deletions
+7 -2
View File
@@ -42,9 +42,14 @@ async function saveEmail(stream) {
const subject = parsed.subject || 'No Subject';
const body = parsed.text || (parsed.html || '');
// Manually create a timestamp for 'Asia/Shanghai' timezone
const received_at = new Date().toLocaleString('sv-SE', {
timeZone: 'Asia/Shanghai'
});
const [result] = await db.execute(
'INSERT INTO emails (recipient, sender, subject, body) VALUES (?, ?, ?, ?)',
[recipient, sender, subject, body]
'INSERT INTO emails (recipient, sender, subject, body, received_at) VALUES (?, ?, ?, ?, ?)',
[recipient, sender, subject, body, received_at]
);
// const [result] = await db.execute(
// 'INSERT INTO emails (recipient, sender, subject, body, raw) VALUES (?, ?, ?, ?, ?)',