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

186
Vistas
How to determine if it is currently Daylight savings time when local time is running on UTC in JavaScript using .isDST() or similar

My issue is- using Postman to parse a JSON API response, I am getting back date and time in UTC. This value could return two possible times; one when DST is active, and one when DST is not active. This is because the time is set in the DB as EST so the delta between UTC/EST/DST is either (-4) or (-5).

As an example, lets say the time in the database is set to 01:00:00 PM Eastern. During DST, this is 05:00:00 PM UTC, during EST this is 06:00:00 PM UTC.

The issue then is, the box we are running these tests on is set to UTC. So I cannot use the delta between "local time" and UTC using getTimezoneOffset to determine the if it is currently DST using the delta. isDST() always returns false for UTC.

I am basically looking to do simple logic to say

if(isDST = true){
   expect(time === 01:00:00);
}
else{
   expect(time === 02:00:00);
}

Any suggestions on how I may be able to determine if DST is currently in effect in this scenario?

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