fix(MySQL): invalid JavaScript datetime values not shown

This commit is contained in:
Fabio Di Stasio 2021-04-16 18:48:56 +02:00
parent 7d2ace9456
commit dcccb544f9
1 changed files with 12 additions and 2 deletions

View File

@ -104,8 +104,18 @@ export class MySQLClient extends AntaresCore {
async connect () {
if (!this._poolSize)
this._connection = mysql.createConnection(this._params);
else
this._connection = mysql.createPool({ ...this._params, connectionLimit: this._poolSize });
else {
this._connection = mysql.createPool({
...this._params,
connectionLimit: this._poolSize,
typeCast: (field, next) => {
if (field.type === 'DATETIME')
return field.string();
else
return next();
}
});
}
}
/**