From 7969294a93a51861c57d4396c7a0d89ecc7e8a84 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Sun, 29 Sep 2024 13:50:22 +0200 Subject: [PATCH] fix(MySQL): incorrect representation of the DATE if the year is prior to 1900, fixes #860 --- src/main/libs/clients/MySQLClient.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/libs/clients/MySQLClient.ts b/src/main/libs/clients/MySQLClient.ts index 8671226e..ec811d4b 100644 --- a/src/main/libs/clients/MySQLClient.ts +++ b/src/main/libs/clients/MySQLClient.ts @@ -232,12 +232,13 @@ export class MySQLClient extends BaseClient { const dbConfig = await this.getDbConfig(); const connection = await mysql.createConnection({ ...dbConfig, - typeCast: (field, next) => { - if (field.type === 'DATETIME') - return field.string(); - else - return next(); - } + dateStrings: true + // typeCast: (field, next) => { + // if (field.type === 'DATETIME') + // return field.string(); + // else + // return next(); + // } }); return connection; @@ -249,12 +250,13 @@ export class MySQLClient extends BaseClient { ...dbConfig, connectionLimit: this._poolSize, enableKeepAlive: true, - typeCast: (field, next) => { - if (field.type === 'DATETIME') - return field.string(); - else - return next(); - } + dateStrings: true + // typeCast: (field, next) => { + // if (field.type === 'DATETIME') + // return field.string(); + // else + // return next(); + // } }); this._keepaliveTimer = setInterval(async () => {