Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

95
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!