1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

fix(MySQL): incorrect representation of the DATE if the year is prior to 1900, fixes #860

This commit is contained in:
2024-09-29 13:50:22 +02:00
parent 2ae016f0b6
commit 7969294a93

View File

@@ -232,12 +232,13 @@ export class MySQLClient extends BaseClient {
const dbConfig = await this.getDbConfig(); const dbConfig = await this.getDbConfig();
const connection = await mysql.createConnection({ const connection = await mysql.createConnection({
...dbConfig, ...dbConfig,
typeCast: (field, next) => { dateStrings: true
if (field.type === 'DATETIME') // typeCast: (field, next) => {
return field.string(); // if (field.type === 'DATETIME')
else // return field.string();
return next(); // else
} // return next();
// }
}); });
return connection; return connection;
@@ -249,12 +250,13 @@ export class MySQLClient extends BaseClient {
...dbConfig, ...dbConfig,
connectionLimit: this._poolSize, connectionLimit: this._poolSize,
enableKeepAlive: true, enableKeepAlive: true,
typeCast: (field, next) => { dateStrings: true
if (field.type === 'DATETIME') // typeCast: (field, next) => {
return field.string(); // if (field.type === 'DATETIME')
else // return field.string();
return next(); // else
} // return next();
// }
}); });
this._keepaliveTimer = setInterval(async () => { this._keepaliveTimer = setInterval(async () => {