Matt Johnson-Pint

codeofmatt.com · Personal blog · on HN since 2016

Matt Johnson-Pint is a time zone and date-time expert who writes about time zone changes, leap day bugs, and epoch time.

What HN saysHN links his posts to show why storing UTC is not always right for future times, and for lists of leap day bugs.
25HN people shared it
12linked it in comments
15stories submitted
365story points
2 years agolast shared
2016people per year2026

Most-shared posts

  1. 1
    List of 2024 Leap Day Bugs
    9 people · 12 points · first shared 2024 · 1 comments on HN
  2. 2
    On the Timing of Time Zone Changes (2016)
    8 people · 34 points · first shared 2016 · 9 comments on HN
  3. 3
    On the timing of time zone changes
    3 people · first shared 2019
  4. 4
    List of 2016 Leap Day Bugs
    2 people · 3 points · first shared 2016 · discussion on HN
  5. 5
    Time zone chaos inevitable in egypt
    2 people · first shared 2016
  6. 6
    2020 Leap Day Bugs
    1 people · 312 points · first shared 2020 · 146 comments on HN
  7. 7
    Please don't call it Epoch Time
    1 people · 4 points · first shared 2021 · discussion on HN
  8. 8
    Time zone chaos inevitable in egypt
    1 people · first shared 2021
  9. 9
    Javascript date type is horribly broken
    1 people · first shared 2019

What HN people wrote when they linked it

NateEag · 2021-02-10
In some cases, storing times in UTC opens you up to possible errors: https://codeofmatt.com/on-the-timing-of-time-zone-changes/ I think the right thing is to store times with the timezone the user wanted when they created the time. You can often use defaults or other UX niceties to streamline specifying TZ, but not always. Also, if you'll want to unambiguously know the timestamp's exact point in time at some point (like for comparison with other dayetimes), you should save the offset from UTC alongside the actual datetime. Otherwise, around clock changes like "fall back" you cannot tell if you're seeing 2 AM for the first or second time. This is the best I've come to trying to piece datetime storage together. If someone has better advice, I'd love to hear it. For more of my theory on timezone handling and the sources I've used to help me think it through, see http://howicode.nateeag.com/dates-and-times.html .
mitsu_at · 2024-07-03
jonsagara · 2024-02-29
Here's a blog post that is tracking issues: https://codeofmatt.com/list-of-2024-leap-day-bugs/
masklinn · 2021-12-29
> Just store the time stamp and time zone separately and update the time stamp to reflect any changes to a time zone's offset Thus reinventing zoned datetimes badly > if that actually happens It happens literally all the time, sometimes with very little heads up e.g. the decision to apply DST or not can be take mere weeks before it actually occurs[0], and something as impactful as an entire calendar day disappearing can happen with 6 months notice[1]. [0] https://egyptindependent.com/egypts-hasty-goodbye-daylight-saving-time… https://codeofmatt.com/time-zone-chaos-inevitable-in-egypt/ [1] https://www.theguardian.com/world/2011/dec/30/samoa-loses-day-date-lin…
mattmanser · 2021-06-28
It can even become wrong for future dates. Always use UTC is a broken, bad rule for future dates, it only makes sense for things that have already happened. As for how it breaks, you have a booking for 8pm the day after the start of summer time. You stored the date/time in UTC. Government changes the start of summer time. Your database now thinks it's at 7pm because it uses UTC. Here's some examples: https://codeofmatt.com/on-the-timing-of-time-zone-changes/ Also the EU is seriously debating getting rid of clock changes, and it comes up in the UK semi-regularly. Your database will not fix your bad data when that happens.
skilpat · 2019-05-27
I don't think the London historical offset should be blamed for such errors, nor should New York's nor any other zone's historical, local mean time offsets. If the tzdb is being used in a buggy way, that's on the user - in this case, pytz. Virtually all systems use tzdb in some form but don't blindly take the earliest historical offsets in a common usage pattern. Fun fact: for many years the ECMAScript spec states explicitly that JavaScript implementations (i.e., a browser's implementation of JS) should use the wrong time zone information! Wrong in the sense of using an offset for _today_ rather than the offset that was applicable at the time of _the Date object_. Maybe they've changed that in recent years, I can't remember, but here's more info: https://codeofmatt.com/javascript-date-type-is-horribly-broken/
raimue · 2018-05-01
I was missing references to the time zone chaos in Egypt, so I looked it up. Apparently that started shortly after the article, but the same author also wrote about that. https://codeofmatt.com/2016/07/01/time-zone-chaos-inevitable-in-egypt/
andrewf · 2017-03-14
I disagree in cases like this, where local wall time is the source of truth. I would go further than OP and not keep UTC time around in a separate column either. Why? On March 13 last year, Chile announced a new daylight savings change, to take place on May 15. [1] Let's say I already had an appointment somewhere for 3:00pm on May 21. When the timezone change was announced, that reservation is still at 3:00pm local. It is not still at the same time in UTC. utc_time is derived from local_time and timezone, not the other way around. (I am generally a fire-breathing advocate for UTC everywhere) [1] http://codeofmatt.com/2016/04/23/on-the-timing-of-time-zone-changes/
mtmail · 2016-07-05
More examples on http://codeofmatt.com/2016/04/23/on-the-timing-of-time-zone-changes/ "Haiti canceled DST for at least the 2016 calendar year. It was scheduled to go into effect on March 13th, but on March 12th (just 1 day notice!) the government issued a press release canceling it."
zer00eyz · 2024-03-17
Payment infrastructure? All of it? Some of it? Recently we had this: https://codeofmatt.com/list-of-2024-leap-day-bugs/ So a day for a grocery chain in Sweden and a gas station chain in New Zealand. For me "There is a 3 out of 4 chance of a damaging earthquake in the Bay Area in the next 30 years." From: https://www.earthquakeauthority.com/blog/2020/san-francisco-bay-area-e… Is this a week of no power (so no cc's, no atm, no cell service). A cornal mass ejection has 1 in 194 odds, is it bad enough that it's a grid killer? I don't know what the odds are for that (as in having EMP), and its gonna be fun if we see it coming to! A major payment processor failing, or payment network failing for a few days is possible. What happens when a grocery chain is open and suddenly "cash only". It has happened before. You dont need a big, or national event where social order is maintained but cash is essential to keeping things moving.
manarth · 2017-01-02
I just came across a note about Morocco, which entered daylight savings time in March 2016, but then left daylight-savings in June for 35 days, re-starting daylight-savings in July [1]. I've read that the explanation for this temporary suspension of daylight-savings is Ramadan [2], and Ramadan is dependent on the observed sighting of the new moon - so you can't necessarily predict the date in advance. I ended up coming across that after looking for an explanation for something bizarre I experienced on a trip to Morocco in March 2016…with my iPhone set to use "Marrakesh, Morocco", the time on the phone displayed correctly, but the time on my sync'd Apple watch was an hour out. I think I ended up manually setting it to Paris time to get the correct time, but never did get an explanation for the difference. So even across two devices from the same manufacturer, theoretically sharing the same date-time information, they can be inconsistent. Conclusion: time is hard! [1] https://www.timeanddate.com/time/change/morocco/tanger?year=2016 [2] http://codeofmatt.com/2016/04/23/on-the-timing-of-time-zone-changes/

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close