From d98ac8236abf973e5babf588a6eaf53930344162 Mon Sep 17 00:00:00 2001 From: Joe <1712833832@qq.com> Date: Sat, 9 Mar 2024 18:39:56 +0800 Subject: [PATCH] Fixed the issue of inconsistent date creation, if the running server and the database are in different regions, the generated date will be inconsistent, and the generated date will be inconsistent --- packages/server/src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 094e3812..519a605b 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -1652,6 +1652,8 @@ export class App { const newChatMessage = new ChatMessage() Object.assign(newChatMessage, chatMessage) + if (!newChatMessage.createdDate) newChatMessage.createdDate = new Date() + const chatmessage = this.AppDataSource.getRepository(ChatMessage).create(newChatMessage) return await this.AppDataSource.getRepository(ChatMessage).save(chatmessage) }