Typeorm converting date to +3 hours?

Viewed 385

I trying get the real hour of a register as do in my postgresSQL, when I access the DB I see

DB Register with Date Today, 11:30

When I do my request

const tomorrow = moment().add(1, 'days');
const today = moment().startOf('day');
return this.ormRepository.find({
  where: {
    startHour: MoreThanOrEqual(today),
    endHour: LessThanOrEqual(tomorrow),
  },
  order: { startHour: 'ASC' },

  join: {
    alias: 'reserves',
    leftJoinAndSelect: {
      table: 'reserves.table',
    },
  },
});

}

with typeorm to view the postgres register I see a different hour Today, 14:30.

Today 14:30 Sample

I don't know whats happening and can't found it in any documentation, in production its all ok, the problem is in my dev and I can't found any solution.

I tested my code in a docker container and the date is coming right (Today, 11:30)

Update: I temporaly solved the problem changing my computer time to UTC

1 Answers

What type of field in postgres you setup ? timestamptz ?

In postgres if you execute select Date() you received UTC

enter image description here

Related