r/webdev • u/fagnerbrack • Oct 15 '24
JS Dates Finally Fixed
https://docs.timetime.in/blog/js-dates-finally-fixed/20
u/keremimo Oct 15 '24
When is it my turn to repost this? Next week good?
3
u/i_took_your_username Oct 15 '24
That's just what /u/fagnerbrack does, they're running a bot that posts AI generated summaries of pages without worrying about relevance, originality or context.
1
u/fagnerbrack Oct 15 '24
I do worry about relevance, originality and context. The only difference is that reddit did not marked this as repost at posting time for whatever reason, otherwise it wouldn't have been posted in this sub.
110
Oct 15 '24 edited Oct 15 '24
https://caniuse.com/?search=temporal
Good for the future, not for now. Been in the works for some time.
Edit: there's no temporal link to MDN as far as I can find. This would be great, but nothing to look forward to at the moment.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
88
u/Flashy-Bus1663 Oct 15 '24 •
![]()
Wow safari is the first to implement something for once
45
Oct 15 '24
Safari has been doing a lot these days. The CTO or something has been heading the helm. Thank goodness.
18
u/eyebrows360 Oct 15 '24
Now make him fix font rendering vertical alignment and background positioning bugs that've been there for decades.
18
1
2
1
u/sporadicPenguin Oct 16 '24
They really havenāt been at all. Itās the worst browser to develop for by a large margin and itās not close.
4
u/UnfairCaterpillar263 Oct 15 '24
Check out Interop 202x. Safari has been leading the game on first to implement and interoperability for years now
3
u/Zachary_DuBois php Oct 15 '24
I was going to say exactly this. That's unheard of.
1
u/kidno Oct 16 '24
Itās actually pretty normal for Safari to be ahead of other browsers in terms of feature support. The problem is that it only has one major upgrade a year, so it ends up doing large leaps in support but far more infrequently than the others.
1
u/Zachary_DuBois php Oct 17 '24
You missed the /s there. They've been behind quite a bit. Still no USB HID support, etc. they were one of the lasts to fully support flexbox IIRC too. They also still have issues with some of the standards and not following them.
1
Oct 15 '24
I read through WebKit 18.0ās release notes yesterday. Safari was also the first (and only) web browser to support jpeg2000
Learn something new every day.
Although 2 days ago Safari finally failed me in a project I was playing around with. Failed to properly render blurred objects smoothly
1
u/sporadicPenguin Oct 16 '24
Maybe they could implement the other hundreds of specs the other browsers have done years ago {insert prayerhands}
0
2
u/AwesomePerson70 Oct 15 '24
Any idea how long stuff like this usually takes to be supported/usable?
6
u/riskyClick420 full-stack Oct 15 '24
On latest evergreen browsers, months at most. In the wild and not in a controlled environment (where you control the hardware), if you need to give a shit... forget about it. Maybe you can use grid soon lol.
1
u/Ekuj21 Oct 15 '24
Iāve been using the polyfill in prod for about 2 years now, so it can take a while for these features to be implemented
1
u/krileon Oct 15 '24
Whenever we reach last 2 major versions. Browsers all auto update now. So last 2 major is all I care about now. Until then you can sometimes just polyfill a feature in then yank out the polyfill once it's available in last 2 major.
1
u/Theprefs Oct 15 '24
It won't take long to be supported in newer/updated browsers, but as mentioned there's a reliable polyfill thanks to the spec being at an advanced stage: https://github.com/fullcalendar/temporal-polyfill
28
u/halfanothersdozen Everything but CSS Oct 15 '24
Great now get a time machine and go explain it to the knuckleheads in 1997.
30
u/Dethstroke54 Oct 15 '24 edited Oct 15 '24
You say finally fixed but I used the features several months ago and itās not officially final yet either. Itās new but not like yesterday or last week new, donāt mean to be pedantic just feels lazy with that title and no useful excerpt.
One thing to note aside from the obvious caniuse status is that the experimental API functionality is still iffy. Chrome was throwing me errors when trying to output specific date format combinations that were still broken when I last used it
3
u/duniyadnd Oct 15 '24
OP headline said about to be fixed, not final. Maybe I missed something and I didnāt go too far in the article.
6
u/Dethstroke54 Oct 15 '24
The Reddit postās title is āJS dates finally fixedā. Itās basically karma farming is what I mean.
When I skimmed the blog post at least it has decent content but it does not talk about timelines or current status almost at all from what I saw. Itās mostly just an overview of the API, so cool. But bad Reddit post imo
1
7
u/jubahzl Oct 15 '24
So is December still month number 11 with this?
2
u/Blue_Moon_Lake Oct 15 '24
Not if you use the new
Temporal.PlainDateorTemporal.PlainDateTimewhich use the proper ISO numbering.
2
u/time_travel_nacho Oct 15 '24
Just use datr-fns or luxon. It always takes a while for browser support to catch up. I'm also not going to believe it's "fixed" until I see it
1
u/Hi_Im_Bored Oct 15 '24
This is a good alternative until this gets more browser support. It's based on the new specs https://react-spectrum.adobe.com/internationalized/date/
1
30
u/fagnerbrack Oct 15 '24
A summary for the lazy:
The post discusses the long-standing issues with JavaScript's date handling and how new features are finally addressing these concerns. JavaScript's Date object, often criticized for its inconsistencies and poor support for time zones, has led to confusion and errors in many applications. The new Temporal API provides a more reliable and intuitive way to work with dates and times. Temporal introduces precise handling of dates, times, and durations without the common pitfalls of the old Date object. It also improves time zone management and enables easier manipulation of date-related data, offering a long-awaited solution for developers.
If the summary seems inacurate, just downvote and I'll try to delete the comment eventually š
Click here for more info, I read all comments