Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

268
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda