Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
Typescript date not the same

I just want to know why these two dates in ISO format are not the same.

const d1 = '2022-08-04T08:16:32.716904'
const d2 = '2022-08-04T08:16:32.716Z'

console.log(new Date(d1).toLocaleString())
// "04/08/2022, 08:16:32"
console.log(new Date(d2).toLocaleString())
// "04/08/2022, 10:16:32"

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The Z stands for the Zero timezone, as it is offset by 0 from the Coordinated Universal Time (UTC).

Source: https://stackoverflow.com/a/29282022/11659853

This means the two Date objects have different time zones. The other Date object probably has your local time zone.

about 4 years ago · Juan Pablo Isaza Relatório

0

The timezone of of d1 is not the same of the timezone of d2. d2 is in Zulu (UTC) while d1 is given in your local timezone since the timezone info was not provided in the datestring.

Notice d2 has a Z letter after the time. d1 misses this.

You can look up more info about ISO datestrings and their timezone offset here: https://en.wikipedia.org/wiki/ISO_8601

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda