I'm using moment.js "timeAgo" to display some dates. But I only want to use the moment.js if the date is within the last week. (7 days ago) After that point I would like to display the date normally. Example: Instead of (3 years ago) (20 June 2010).
I have the default working with this code. Any help would be great.
var date = moment.unix (& lt ;? php echo $ date;? & Gt;) FromNow (); . ("# Date") $ enclosed (date);
var someDate = moment.unix ( 7) {$ ("# date"). Attachment (someDate.format ("dddd, MMMM Do YYYY")); } And {$ ("# date"). Attachment (someDate.timeAgo ()); }
No comments:
Post a Comment