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

296
Visualizações
Why new Date("1651214829629") show Invalid Date in chrome?

In chrome i type it will show this? i can under why?

enter image description here

>new Date("1651214829629")

Invalid Date

>new Date(1651214829629)

Fri Apr 29 2022 14:47:09 GMT+0800 (中国标准时间)

>new Date("110")

Wed Jan 01 0110 00:00:00 GMT+0805 (中国标准时间)
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Like Hao-Jung Hsieh said, if you give a string to new Date(), it will interpret it as a dateString, not a timestamp. To parse a dateString, new Date() will call Date.parse(), which is detailed in the ECMAScript docs here. Date.parse() will first time to parse the dateString according to the Date Time String Format. The Date Time String Format says that if you only give one number, that number will be interpreted as the year, which is usally in the range 0-9999 (as defined by ISO 8601), but ECMAScript provides an extension to support years outside this range, which is detailed in the Expanded Years section. With this extension, the year can be be in the range -273,790 to 273,790.

So, when you provide run new Date("1651214829629"), Chrome will interpret 1651214829629 as a year. 1651214829629 is not in the acceptable range, therefore it is an invalid date.

about 4 years ago · Juan Pablo Isaza Relatório

0

when you use a string, new Date() will think it's a dateString instead of a timestamp. "110" is meaning at 1:10. It just can't understand what is the dateString of "1651214829629".

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date

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