I’ve been using the awesome momentjs library to format and display dates in my app. So far, I’ve been able to get stuff like ‘4 days ago’, ‘3 weeks left’ to show.
However, there is a feed page in the app, and I want to be able to format the date of each post to display as:
‘1d’, ‘3w’, ‘2y’ for days, weeks and years. Also, if the post was just created, it should display something like ‘Just Now’. I’ve been trying to get this working for some time now. How do I get this done?
Thanks for your help guys.