From 35479c7690791cde3a1c6a18b938a9fc917edbfd Mon Sep 17 00:00:00 2001 From: Nelson Chan <3271800+chakflying@users.noreply.github.com> Date: Sun, 3 Dec 2023 01:34:26 +0800 Subject: [PATCH] Fix: Disable timezone conversion for mariadb (#3756) --- server/database.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/server/database.js b/server/database.js index 4162e33177..4a12746f5f 100644 --- a/server/database.js +++ b/server/database.js @@ -263,7 +263,14 @@ class Database { user: dbConfig.username, password: dbConfig.password, database: dbConfig.dbName, - timezone: "+00:00", + timezone: "Z", + typeCast: function (field, next) { + if (field.type === "DATETIME") { + // Do not perform timezone conversion + return field.string(); + } + return next(); + }, }, pool: mariadbPoolConfig, }; @@ -277,6 +284,14 @@ class Database { socketPath: embeddedMariaDB.socketPath, user: "node", database: "kuma", + timezone: "Z", + typeCast: function (field, next) { + if (field.type === "DATETIME") { + // Do not perform timezone conversion + return field.string(); + } + return next(); + }, }, pool: mariadbPoolConfig, };