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.”
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. 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.