July 2017
Intermediate to advanced
374 pages
8h
English
Before we deep dive into Flux, a little thing we need to add to our views is the date feature. Earlier, you were seeing the timing of the tweets that are stored in the database as the TZ format; however, ideally, it should be compared with current timings and should be shown in reference to it.
In order to do that, we will need to update our main.jsx file so that it will format our tweets. Add the following code to main.jsx:
updatetweets(tweets){
let updatelist = tweets.map(tweet => {
tweet.updatedate = moment(tweet.timestamp).fromNow();
return tweet;
});
}
Our work is done here. Now, our tweet should look something like this: