JavaScript Temporal Is Coming
developer.mozilla.org
JavaScript Temporal Is Coming
1–10 of 20 posts
Re: JavaScript Temporal Is Coming
#2Re: JavaScript Temporal Is Coming
#3Re: JavaScript Temporal Is Coming
#4I already use it in prod because it is light years better than the alternative
Re: JavaScript Temporal Is Coming
#5Re: JavaScript Temporal Is Coming
#6Why?!
The thing I hate most about most SQL DateTime/Timestamps are their choice to default to TZ ambiguity. Too often it means everything must actually be UTC nearly all the time, or you get messy data that could be any zone. I.e. It's a lossy data type.
TZ unaware should not be an option. Or if there's truly a case for it then it should at least be some non default, opt in, with 'dangerous' in the type name(s).
Re: JavaScript Temporal Is Coming
#7Re: JavaScript Temporal Is Coming
#8> Time-zone-unaware date/time ("Plain") Why?! The thing I hate most about most SQL DateTime/Timestamps are their choice to default to TZ ambiguity. Too often it means everything must actually be UTC nearly all the time, or you get messy data that could be any zone. I.e. It's a lossy data type. TZ unaware should not be an option. Or if there's truly a case for it then it should at least be some non default, opt in, wi…
I'm sure it's been discussed here before, but for calendar events you don't necessarily want a timezone attached, you want a location - "this event happens at 9am according to whatever timezone is currently in effect in Auckland, NZ". That's a thing that UTC or timezone-aware Datetimes can't help with.
Re: JavaScript Temporal Is Coming
#9> Time-zone-unaware date/time ("Plain") Why?! The thing I hate most about most SQL DateTime/Timestamps are their choice to default to TZ ambiguity. Too often it means everything must actually be UTC nearly all the time, or you get messy data that could be any zone. I.e. It's a lossy data type. TZ unaware should not be an option. Or if there's truly a case for it then it should at least be some non default, opt in, wi…
These aren't "TZ ambiguous". These are "this thing does not logically have a specific associated timezone". For things which do logically have a specific associated timezone, there's ZonedDateTime.
Re: JavaScript Temporal Is Coming
#10> Time-zone-unaware date/time ("Plain") Why?! The thing I hate most about most SQL DateTime/Timestamps are their choice to default to TZ ambiguity. Too often it means everything must actually be UTC nearly all the time, or you get messy data that could be any zone. I.e. It's a lossy data type. TZ unaware should not be an option. Or if there's truly a case for it then it should at least be some non default, opt in, wi…
Calendar events often want to be interpreted according to whatever the local timezone currently is. For instance "10am every second Sunday" shouldn't adjust to 9am during Daylight-Savings time. And my 7am alarm clock should definitely not change to 7pm because I flew from Aotearoa to England. I'm sure it's been discussed here before, but for calendar events you don't necessarily want a timezone attached, you want a l…
Alarms are something of a special case, and with TZ aware types one could still adapt at the application later.
For a gift card system I once had relative expiration, enforced using the zone of the merchant location. Using a relative type actually felt like more work because from the merchant perspective, all that mattered was the point in time relative to their zone. It would've been simpler to do the offsetting in the app layer checks. And ultimately no one cared enough to keep maintaining it anyway, having an absolute point in time is usually good enough or even preferred.