News for hackers. Stuff that matters.
Re:Node.js 26.0.0 (Now with Temporal) by jpsimons on Wednesday May 20, 2026 @03:33PM (#48212915)
I always thought the old Date is kind of elegant... increment anything with an overflow and it all wraps around correctly, like `d.setDate(d.getDate() + 100)` to advance a date 100 days. "March 208th" is interpreted like you'd expect, as are the hours and minutes and such.

Of course, complete lack of non-local non-GMT time zones is a huge downside.

Re:Node.js 26.0.0 (Now with Temporal) by keeganpoppen on Wednesday May 20, 2026 @03:43PM (#48213064)
i'm pretty sure all that stuff works w/ Temporal... Temporal is extremely well-designed, in my experience. the js date object, on the other hand, has insane pitfalls, and i say this as someone who thinks not understanding JS ASI is a "skill issue", among other happily-un-"ergonomic" worldviews...
Re:Node.js 26.0.0 (Now with Temporal) by kaoD on Wednesday May 20, 2026 @06:44PM (#48215329)
That's how you get date bugs.
Re:Node.js 26.0.0 (Now with Temporal) by kaelwd on Thursday May 21, 2026 @09:53AM (#48222579)
`d.add({ days: 100 })` also wraps like you'd expect. `d.with({ day: 208 })` becomes the last day of the month instead but "March 208th" is kinda nonsense anyway so whatever. You could emulate it with `d.add({ days: 208 - d.day })`