Hacker News new | ask | show | jobs
by iainmerrick 1346 days ago
Instead of using something that works right now, you’re saying people should hold off for a few months, then start using a prerelease API?
4 comments

Welllll… “works right now” is perhaps an overly strong assertion when it comes to day.js. I was working on a library we use for parsing "schedules" (like, alarm turns on at 9:00pm on Thursday, and off again at 7:00am on Friday). I was doing things like computing the number of seconds until the next scheduled transition. I tried switching from moment to day.js, and my unit tests immediately failed. Within a couple of hours I’d opened two bugs [1][2], both related to incorrect behaviour in corner cases (like generating the incorrect date when near a daylight saving time transition).

The fact that it only took me a few hours to find these suggests there are plenty more bugs like these to find. The fact that these bugs have been open since the start of March with no movement on them suggests they aren’t too interested in correct behaviour (or perhaps they’re just your typical under-staffed open source project).

Maybe I just got super unlucky and ran into the only two bugs here… but it’s not likely.

Luxon and moment.js both handled these cases perfectly. If you’re looking to move from whatever you’re using now, and you can’t wait for the new standard, I’d pick one of those.

[1]: https://github.com/iamkun/dayjs/issues/1816

[2]: https://github.com/iamkun/dayjs/issues/1817

They mentioned "switching" which implies an already working solution. Within that context, yeah, maybe wait a few months if you can afford to.

Also, once the spec is finalized, there may also be a compliant polyfill available. If so, you'll get the functionality early and still have good compatibility down the line.

If you have something working, perhaps delay refactoring to a new library.

Or as it is coming RealSoonNow(tm) perhaps start looking into polyfills as you are going to need one anyway for a story time at least to support LTS browser versions.

A more charitable read might be, "If you're going to change to something, you might be able to wait and make 1 change rather than 2."