feat(docker): 安装 tzdata 并设置 TZ=Asia/Shanghai 以让 Node.js 使用上海时区
This commit is contained in:
@@ -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 (?, ?, ?, ?, ?)',
|
||||
|
||||
Reference in New Issue
Block a user