mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(Postgres Node): Special datetime values cause errors (#11225)
Co-authored-by: Elias Meire <elias@meire.dev>
This commit is contained in:
parent
ba158b4f85
commit
3c57f46aae
|
@ -65,7 +65,13 @@ export async function configurePostgres(
|
|||
// 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();
|
||||
const parsedDate = new Date(value);
|
||||
|
||||
if (isNaN(parsedDate.getTime())) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return parsedDate.toISOString();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue