The first thing we're going to do is tweak our message.js file. Currently inside message.js, we generate timestamps using new Date().getTime. We're going to switch over to Moment, not because it changes anything, I just want to be consistent with using Moment everywhere we use time. This is going to make it a lot easier to maintain and figure out what's going on. At the top of the message.js, I'm going to make a variable called moment setting it equal to require('moment'):
var moment = require('moment');var generateMessage = (from, text) => { return { from, text, createAt: new Date().getTime() };};
And we're going to go ahead and replace the createdAt property with calls to valueOf. What I would like you to do ...