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

98
Vistas
How can I explain this timezone behavior of Date?

For the JS Date object, ISO 8601 date strings that specify a time are treated as local (Note 2, here).

If we assume the locale for a machine is configured to be in England, and the current date in England is 23rd September 2022, the current local time zone (?) is UTC+0100 (British Summer Time).

If I supply a date without timezone that would in my locale ordinarily be in summertime (so in BST), then Date treats the string as BST (unsurprising).

If I supply a date without timezone that would, in my locale, ordinarily be outside of summertime (so in UTC), then Date treats the string as UTC (surprising, as UTC is not currently my local timezone).

new Date('2022-06-01T12:00:00') // Wed Jun 01 2022 12:00:00 GMT+0100 (British Summer Time)
new Date('2022-01-01T12:00:00') // Sat Jan 01 2022 12:00:00 GMT+0000 (Greenwich Mean Time) (! - my local timezone is BST, not GMT!)

How do I explain this? Is BST a time zone, or is it something else (eg. a mode of a timezone)?

almost 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

The timezone BST/British Summer Time does not exit on Jan 1st. The areas that use BST on the summer use GMT during the winter.

almost 4 years ago · Santiago Trujillo Denunciar

0

For ISO 8601 date-times without a defined time zone, JavaScript does not assume the time zone to be the same as the time zone locally in effect, it assumes the local geographic location and then chooses the time zone that would be in effect at the specified wall-clock time in that location. Or something.

almost 4 years ago · Santiago Trujillo 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