Table of Content
MomentJS
Before moving on the next module, we will add a small touch to the news time by using MomentJS library.
Last time we used a JavaScript library to manipulate set. This time, we introduce the library for date and time – MomentJS
Download the moment.min.js
file and include it in the HTML file.
1<script src='vendors/moment.min.js'></script>
When we display the date of the news in the content, we add an extra information to show how long ago is that news.
1"<small> (" + moment(newsData.date, 'YYYY-MM-DD hh:mm:ss').fromNow() + ") </small>"
What’s next? We’re going to take a look at “Gallery”.