7 ms·
I'm really looking forward to the temporal api being universally available. Moment and Luxon are fairly good but sensible date/time handling is something that r
by noodlesUK 4mo ago
I'm really looking forward to the temporal api being universally available. Moment and Luxon are fairly good but sensible date/time handling is something that really ought to be baked into the platform ootb.
- culi 4mo agoUntil then, a solid backfill has been available for quite some time
- jpsimons 4mo agoI 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.
- keeganpoppen 4mo agoi'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...
- kaoD 4mo agoThat's how you get date bugs.
- kaelwd 4mo ago`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 })`