fix-pg-timezone.ts 412 B

12345678910
  1. /**
  2. * Hack to fix pg driver date handling. See https://github.com/typeorm/typeorm/issues/2622#issuecomment-476416712
  3. */
  4. export function fixPostgresTimezone() {
  5. if (process.env.DB === 'postgres') {
  6. // eslint-disable-next-line @typescript-eslint/no-var-requires
  7. const pg = require('pg');
  8. pg.types.setTypeParser(1114, (stringValue: string) => new Date(`${stringValue}+0000`));
  9. }
  10. }