Skip to Content
Advanced Node.js Development
book

Advanced Node.js Development

by Andrew Mead
March 2018
Intermediate to advanced
592 pages
13h 44m
English
Packt Publishing
Content preview from Advanced Node.js Development

Updating the newLocationMessage property

Now for Send Location, we currently don't use Moment; we only updated the newMessage event listener. This means that when we print that location message, we don't have the timestamp. We're going to modify newLocationMessage, you can go ahead and use the same techniques we used previously to get the job done. Now in terms of where to actually render the formatted time, you can simply put it in li.text just like we did earlier in case of newMessage property.

Step one in the process is going to be to make that variable called formattedTime. We can actually go ahead and copy the following line:

var formattedTime = moment(message.createdAt).format('h:mm a'); 

And pasting it right above the var li = ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Node.js Development

Learning Node.js Development

Andrew Mead
Serverless Applications with Node.js

Serverless Applications with Node.js

Aleksandar Simovic, Slobodan Stojanovic
Node.js: Tools & Skills, 2nd Edition

Node.js: Tools & Skills, 2nd Edition

James Hibbard, Michael Wanyoike, Nilson Jacques, Jay Raj, Manjunath M
Your First Week With Node.js, 2nd Edition

Your First Week With Node.js, 2nd Edition

James Hibbard, Craig Buckler, Mark Brown, Nilson Jacques, James Kolce, Paul Orac, M. David Green, Florian Rappl

Publisher Resources

ISBN: 9781788393935Supplemental Content