News for hackers. Stuff that matters.
Re:JavaScript dates are about to be fixed by mirekrusin on Saturday August 24, 2024 @02:51PM (#41340482)
Past/future doesn't matter, what matters is context. You don't need to use timezones for ie. setTimeout even though it refers to the future and you should have timezone available for past events ie. atm withdrawal.
Re:JavaScript dates are about to be fixed by marshmellman on Saturday August 24, 2024 @02:59PM (#41340550)
setTimeout takes a duration in ms, not a timestamp. If it did take a timestamp, I think you would need to pass it a timezone to disambiguate.

Maybe a better argument is, “when you’re setting a phone alarm, you don’t tell it a timezone.” Maybe the distinction is whether the timezone is established at write time or read time.

Re:JavaScript dates are about to be fixed by jitl on Saturday August 24, 2024 @03:47PM (#41340935)
Scheduling on a calendar (occur on date X, time Y, in zone Z) and scheduling based on timedelta from instant time (occur exactly X milliseconds before or after instant Y) are both valid, and you can do timedelta scheduling in UTC without needing timezones. The issues come from conflating the two; using timedelta reasoning for calendar scheduling, or using calendar scheduling when you want an exact timedelta.
Re:JavaScript dates are about to be fixed by lxgr on Saturday August 24, 2024 @04:32PM (#41341262)
> when you’re setting a phone alarm, you don’t tell it a timezone.

Which coincidentally and ironically makes phone alarms surprisingly difficult to implement in a way that does not break in the face of DST shifts, timezone changes etc., as Apple has learned the hard way a couple of times.

Re:JavaScript dates are about to be fixed by Denvercoder9 on Saturday August 24, 2024 @04:29PM (#41341246)
> Past/future doesn't matter

Past/future does matter, as generally speaking it's possible to accurately convert between local time and UTC for times in the past, but not in the future.

There's a few exceptions where governments have retroactively changed timezones or DST rules, but at that point you've lost anyway.