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

340
Vistas
Passing my payload through JSON.parse alters my date object values to not line up

Prior to using JSON.parse(), my payload contents are as follows:

let payload = {
     "name":"bob",
     "timeDetails":
        [
            {
                "windowName":"Window A",
                "windowTimes":
                    {
                        "startDate":"2021-11-20T20:39:46.785Z",
                        "endDate":"2021-11-20T20:39:54.786Z"
                    }
            }
        ]
    }

So paying particular attention to my dates, when I then proceed to issue the following on the above payload, i.e.:

let job = JSON.parse(payload);
console.log(job);

I am now getting the following startDate and endDate returned which is not the same as my original payload dates, i.e. from my console log:

startDate: Sun Nov 21 2021 16:00:00 GMT+1100 (Australian Eastern Daylight Time) {}
endDate: Sun Nov 21 2021 23:00:00 GMT+1100 (Australian Eastern Daylight Time) {}

I am not so much concerned about the time portion but I would've thought I would've seen the dates as: Sat Nov 20 2021 for both startDate/endDate?

Can someone help with what I am missing as need to ensure that dates are like for like.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Taking date string as UTC Time zone ("2021-11-20T20:39:46.785Z", UTC format). It adds 11 (GMT+1100 (Australian Eastern Daylight Time) hours to UTC time, so adding 11 hours to Nov 20 gets Nov 21 as a result If you want to get the Exact UTC zone we have to convert it to UTC format

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