Skip to content

Commit

Permalink
fix(MySQL): incorrect representation of the DATE if the year is prior…
Browse files Browse the repository at this point in the history
… to 1900, fixes #860
  • Loading branch information
Fabio286 committed Sep 29, 2024
1 parent 2ae016f commit 7969294
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/main/libs/clients/MySQLClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 () => {
Expand Down

0 comments on commit 7969294

Please sign in to comment.