title: Node.js with TypeORM inserts wrong timezones into Azure SQL Database
body: <p>I have a backend written on top of node.js, I'm using <a href="https://typeorm.io/#/" rel="nofollow noreferrer">TypeORM</a> as the ORM and Azure SQL Database to store my data. When I call the ORM's create() and save() functions, I'm passing in the correct date and time as can be seen below. But when I query the inserted data in the server, the timezone has shifted from -03:00 to +00:00. It maybe a normal behavior, since I'm new working with dates though.</p>
  
  <p>This is the code where I call the create() in:</p>
  
  <pre><code>class CreateAppointmentsService {
    public async execute({ provider, date }: RequestDTO): Promise&lt;Appointment&gt; {
      const appointmentsRepository = getCustomRepository(AppointmentsRepository);
      const roundDate = startOfHour(date);
      const foundAppointment = await appointmentsRepository.findByDate(roundDate);
      if (foundAppointment) {
        throw Error('This date and time already has a booking.');
      }
      const appointment = appointmentsRepository.create({
        provider,
        date: roundDate,
      });
      await appointmentsRepository.save(appointment);
      return appointment;
    }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/tWlIL.png" rel="nofollow noreferrer">This is my debug information, showing date and time in expected timezone.</a></p>
  
  <p><a href="https://i.stack.imgur.com/GRctg.png" rel="nofollow noreferrer">This is the data in the database.</a> The field type is <a href="https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetimeoffset-transact-sql?view=sql-server-ver15" rel="nofollow noreferrer">datetimeoffset</a> and the server time is set to UTC (+00:00).</p>
  
  <p>Thanks in advance! =)</p>
  
  <p>[EDIT]: Explaining better: the time I posted to the database is rounded to 20:00 -03:00 (America/Sao_Paulo/Brasilia). If you look the column "created_at", the time is updated to UTC, but the column "data" only got the timezone set to +00:00, the time remais 20:00.</p>