mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(Postgres Node): Always return TIMESTAMP and TIMESTAMPZ as ISO string (#6145)
* fix(Postgres Node): Always return TIMESTAMP and TIMESTAMPZ as ISO string * Fix linting issues
This commit is contained in:
@@ -47,6 +47,15 @@ async function configurePostgres(
|
||||
) {
|
||||
const pgp = pgPromise();
|
||||
|
||||
if (typeof options.nodeVersion == 'number' && options.nodeVersion >= 2.1) {
|
||||
// Always return dates as ISO strings
|
||||
[pgp.pg.types.builtins.TIMESTAMP, pgp.pg.types.builtins.TIMESTAMPTZ].forEach((type) => {
|
||||
pgp.pg.types.setTypeParser(type, (value: string) => {
|
||||
return new Date(value).toISOString();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (options.largeNumbersOutput === 'numbers') {
|
||||
pgp.pg.types.setTypeParser(20, (value: string) => {
|
||||
return parseInt(value, 10);
|
||||
|
||||
Reference in New Issue
Block a user