Earlier quoted context omitted.
Pro tip: never ever use anything but ISO dates in UTC tz unless you're displaying it for a user in a UI.
Some use cases really do require the local TZ offset be saved. Transforming everything to UTC wipes out that information. An engineer in the US reviewing industrial measurements logged in a plant in Asia from a variety of sources is definitely going to encounter lots of events recorded in local time. It would be maddening for that engineer to have to review and resolve events from different time coordinates, especial…
Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
131–140 of 167 posts
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#132[flagged]
Just imagine building websites using literally any other language.
Sounds glorious, doesn't it?
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#133Earlier quoted context omitted.
Some use cases really do require the local TZ offset be saved. Transforming everything to UTC wipes out that information. An engineer in the US reviewing industrial measurements logged in a plant in Asia from a variety of sources is definitely going to encounter lots of events recorded in local time. It would be maddening for that engineer to have to review and resolve events from different time coordinates, especial…
You mean you must record the timezone? Because the TZ offset can change throughout the year (e.g. due to daylight saving time).
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#134Earlier quoted context omitted.
There's a good post about why this isn't as foolproof an approach as it might first seem here https://codeblog.jonskeet.uk/2019/03/27/storing-utc-is-not-a...
The post doesn’t account for the case where a suburb of Amsterdam breaks off from the rest of Netherlands and changes timezones… Then how do you know if the event was in the neighborhood or not? My point is that this is an extremely niche case and works around one particular type of timezone insanity. You either have a team dedicated to dealing with timezone insanity, or you store stuff in UTC.
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#135Earlier quoted context omitted.
> never ever use anything but ISO dates in UTC tz unless you're displaying it for a user in a UI. Not good for storing future meeting times. DST switchover dates can change, and your tz-normalized date won't change with it.
To me that an UI/UX issue. Internally everything is stored and handled in TAI (better than UTC as no discontinuity) and translated from/to something else for human consumption. I.e. for instance your should have logic to figure out what TAI period corresponds to "next month's meetings" if that's what the user wants, which you apply immediately on user inputs and then forget about DST, time zones, etc. in the rest of…
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#136Earlier quoted context omitted.
Safari is too valuable of a platform for web developers to ignore, but otherwise yes it's the only real exception to the Chrome monopoly and still certainly much smaller in terms of absolute users.
I use Firefox on all my devices.
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#137Earlier quoted context omitted.
To me that an UI/UX issue. Internally everything is stored and handled in TAI (better than UTC as no discontinuity) and translated from/to something else for human consumption. I.e. for instance your should have logic to figure out what TAI period corresponds to "next month's meetings" if that's what the user wants, which you apply immediately on user inputs and then forget about DST, time zones, etc. in the rest of…
No, it is not. It is because converting to UTC loses information that can't be retrieved.
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#138Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#139[flagged]
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#140WAT [1] [1] https://www.destroyallsoftware.com/talks/wat
It's a good talk but it's an even better talk if you actually like JS and understand not only why those things are the way they are but also that you wouldn't ever do them in normal code.