Jerod Santo changelog.com/posts

Moment.js is a Swiss Army Knife for dealing with Time in JavaScript

Judging from how many stars Moment.js has garnered on GitHub, you may already know about it. But for those who haven’t, Moment.js is Tim Wood’s highly polished and well-documented JavaScript library for parsing, validating, manipulating, and formatting dates.

It runs in the browser or Node.js, supports many languages, has a great API, and has saved this Changelogger countless hours over the years. Here are a few example uses from the project’s homepage:

moment().startOf('day').fromNow();
moment().add('days', 10).calendar();
moment().format("MMM Do YY");

The library weighs in at just 5.5kb and recently reached version 2.0, so if you haven’t looked at it in awhile now’s the time to check it out once again!


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00