I use time.js "timeAgo" to display some dates. But I want to use moment.js only if the date is in the last week. (7 days ago) After this point, I just wanted to show the date as usual. Example: (June 20, 2010) instead of (3 years ago).
I have default options working with this code. Any help would be great.
var date = moment.unix(<?php echo $date; ?>).fromNow(); $("#date").append(date);
source share