March 2018
Intermediate to advanced
592 pages
13h 44m
English
Now the next step in the process is going to be to get all the data showing, we have a from property and a createdAt property too. We actually have access to that createdAt property via formattedTime.
We're going to go ahead and uncomment the formattedTime line, and this is the only one we're actually going to carry over to the new system. I'm going to add it up inside newMessage callback:
socket.on('newMessage', function (message) { var formattedTime = moment(message.createAt).format('h:mm a'); var template = jQuery('#message-template').html(); var html = Mustache.render(template, { });
Because we do still want to use formattedTime when we render. Now before we do anything else with the template, let's go ...