Now when you get into formatting like this, your first instinct is usually to create some utility methods that help with formatting a date. But there is no need to do that because what we're going to look at in this section is a fantastic time library called Moment. Moment is pretty much the only library of its kind. It is universally accepted as the go-to library for working with time and JavaScript, I've never worked on a Node or frontend project that didn't have Moment used, it is truly essential when you're working with dates in any capacity.
Now in order to show off why Moment is so great we are going to first install it over inside of the Terminal. Then we're going to play around with all of its capabilities, it has a lot. We can install it by running npm i, I'm going to go ahead and use the current version moment@ version 2.21.0, and I will also use the --save flag to add it as a dependency, a dependency that we're going to need on Heroku as well as locally:
npm i moment@2.21.0 --save
Now once it's installed I can use clear to clear the Terminal output, and we can go ahead and restart nodemon. Over inside the playground folder it's time to require Moment and take a look at exactly what it can do for us.
To kick things off, let's go ahead and try to fix the problem we tried to solve with date. We want to print the shorthand version of a month like Jan, Feb, and so on. The first step is going to be to comment the previous code out and load in Moment previous at the top, requiring it. I'm going to make a variable called moment and require it by requiring the moment library:
var moment = require('moment');
// Jan 1st 1970 00:00:10 am
//var date = new Date();
//var months = ['Jan', 'Feb']
//console.log(date.getMonth());
Then next to this code, we'll kick things off by making a new moment. Now just like we create a new date to get a specific date object, we're going to do the same thing with moment. I'm going to call this variable date and we're going to set it equal to a call to moment, the function we loaded in previous, without any arguments:
var moment = require('moment');
// Jan 1st 1970 00:00:10 am
//var date = new Date();
//var months = ['Jan', 'Feb']
//console.log(date.getMonth());
var date = moment();
This creates a new moment object that represents the current point in time. From here we can go ahead and try to format things using its really useful format method. The format method is one of the main reasons I just love Moment, it makes it dead simple to print whatever you want as a string. Now in this case, we have access to our date and we're going to go ahead and call that method I just talked about, format:
var moment = require('moment');
var date = moment();
console.log(date.format());
Before we get into what we pass to format let's go ahead and run it just like this. When we do that over inside the Terminal, nodemon is going to go ahead and restart itself, and right here we have our formatted date:

We have the year, the month, the day, and other values. It's not still really user-friendly but it is a step in the right direction. The real power of the format method comes when you pass a string inside of it.
Now what we pass inside the format method is patterns, which means that we have access to a specific set of values we can use to output certain things. We're going to explore all of the patterns available to you in just a second. For now, let's go ahead and just use one; it's the triple uppercase M pattern:
var date = moment();
console.log(date.format('MMM'));
When Moment sees this pattern inside, format it's going to go ahead and grab the shorthand version of the month, which means if I save this file and restart it over inside the Terminal once again. We should now see the shorthand version for the current month September, which would be Mar:

Right here we have Sep just as expected and we were able to do that super simply by using the format method. Now format returns a string that has just the things you specify. Here we only specified that we want the shorthand version of the month, so all we got back was the shorthand version of the month. We can also add on another pattern, four Ys, which prints out the full year; in the current case, it would print out 2016 in numbers:
console.log(date.format('MMM YYYY'));
I'm going to go ahead and save time again and right here we get Mar 2018:

Now Moment has a fantastic set of documentation so you can use whatever patterns you like.