DEV Community

Cover image for Moment.js & The Selflessness of Developers
Otto Nagengast
Otto Nagengast

Posted on • Updated on • Originally published at blog.antcode.dev

Moment.js & The Selflessness of Developers

A couple of days ago, I saw a post on Hacker News about some announcements from Moment.js. If you’ve done web development with JavaScript, there’s a good chance you’ve used Moment.js. If you’re not familiar with it, it’s a library that makes it much easier to work with times and dates.

I clicked through to the announcement to see if there were any new or deprecated features that I should be aware of. Instead there was something very different. At the top of their main documentation page, the Moment.js team had added a long preamble.

First they discussed how popular the package is (12 million downloads a week!) and then some common complaints (Moment objects are mutable!). Then they dropped a bomb: “We recognize that many existing projects may continue to use Moment, but we would like to discourage Moment from being used in new projects going forward.” Woah!

The surprises kept coming. The authors explained some of the main drawbacks of Moment.js and they provided extensive links to deeper explanations and alternatives. But they also make it clear that they are not killing Moment.js. It is too important to too many projects. They will continue to make critical fixes and updates. They just won’t be adding new features. As they put it, “ [Moment.js] is not dead, but it is indeed done.”


...
Do you want feedback on your JavaScript code?
Come join our code review Slack group!
Just click the link at the top of our landing page: https://antcode.dev.
...

Stop and think about this situation for a moment (pun intended). To appreciate how peculiar it is, let’s consider a similar situation in a different context. What if Apple operated like Moment.js? You walk into the Apple store to buy a new phone. An employee tells you, “Actually, you shouldn’t buy an iPhone. You should go buy a Samsung. The camera is way better, and the battery lasts way longer. But you can keep using your current iPhone. We’ll make sure any software updates work seamlessly with your old model.” If this happened to me, I would think the salesperson was either crazy, pissed at Apple and trying to get revenge, or playing some reverse psychology trick to actually get me to buy an iPhone.

But in open source, this sort of thing is normal. People build something and put it out into the world. Other people start using it, and they notice flaws. Some of them choose to contribute code to fix those flaws. Most just complain and hope that someone else will fix them. The maintainers work hard to make everyone happy which is a nearly impossible task. In fact, users of open source projects can sometimes get downright nasty and mean with the maintainers.

What do the maintainers get for all of the work, stress, and abuse? Money? Maybe they’re lucky to get some sponsorship money but it’s not going to make them rich. (The Moment.js team explicitly turned down sponsorship because the core team members all have good jobs and don’t need the money). What about recognition? Maybe, but how much does the world care about GitHub stars? Their resume? Perhaps but there are more efficient ways to get lucrative software engineering jobs.

I would argue that the main motivation is selflessness. Developers want to help other developers. They want to contribute to the common good. What a beautiful thing. With one piece of code, a developer can help people around the world now and for years to come. But then when something new comes along that better serves the common good, it is time to graciously and selflessly step aside.

This is what the maintainers of Moment.js did this week. We should congratulate them not just on their great work but also admire them for their ability to put the community before themselves.

Top comments (4)

Collapse
 
v6 profile image
🦄N B🛡 • Edited

// , Easy enough, in the world of Startup dreams & monetization, to forget the reason much of the most important code out there (Linux, Bitcoin, curl, etc.) was ever written:

Because someone wanted things to be better, overall. For all of us who would want to use it.

Thanks for the reminder bro

Collapse
 
annietaylorchen profile image
Annie Taylor Chen

I really admire people who contribute to open source out of both passion and altruism. Just like volunteering, you should be grateful for people who work for free, not demanding. Otherwise you might as well just use some paid service, then they're obliged to solve your problem!

Collapse
 
mhshankar84 profile image
Hari Shankar M

Considering the passion with which they would have contributed to Moment, it certainly is admirable to see them show responsibility.
Having said that, Moment tried to fill a gap caused by a limitation in the language. Ideally, the language should have addressed it. It is high time the language addresses it natively.
Moment.js played its part in highlighting the problem and thus contributed to the language development. Put differently, such libraries which should be ideally native functionality will cease to exist in the long run.

Collapse
 
madza profile image
Madza

please create a post with #showdev or make a listing if you want to promote something, instead of spamming 😉