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

267
Visualizações
Converting a moment to JS Date in ISO format

I have been trying somewhat unsucessfully to convert a date I have in Moment format to a JS Date object that is in the ISO 8601 format. The API library I am using needs the date to be a JS Date object but needs to format to be 8601. When I try this now my moment is the correct time in 24 hour format

Moment {_isAMomentObject: true, _i: '2021-10-07T15:00:00', _f: 'YYYY-MM-DDTHH:mm:ss', _isUTC: true, _pf: {…}, …}
_a: (7) [2021, 9, 7, 15, 0, 0, 0]
_d: Thu Oct 07 2021 11:00:00 GMT-0400 (Eastern Daylight Time) {}
_f: "YYYY-MM-DDTHH:mm:ss"
_i: "2021-10-07T15:00:00"
_isAMomentObject: true
_isUTC: true

but when I convert to a date it tries to fix the timezone so its always off by 4 hours so like momentVar.toDate() =

Thu Oct 07 2021 11:00:00 GMT-0400 (Eastern Daylight Time)

the moment gets set initially through url param:

eventTime=2021-10-07T15:00:00

what is the right get a JS Date object in an ISO 8601 format but not as a string with the .toISOstring() method

about 4 years ago · Juan Pablo Isaza
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