Closed ghost closed 8 years ago
I'm so sorry about my bad eng.
Hi, thanks for your contribution!
What is your use case for this feature ?
For exaple I have time tag with amTimeAgo directive.
Now: 12:00 AM. post.created_at: 12:00 AM.
We will seen: a few seconds ago.
<time am-time-ago="post.created_at" am-full-date-threshold="60" am-full-date-threshold-diff="minute" am-full-date-format="{{ post.created_at | getDateFormat }}"</time>
getDateFormat (filter) : // if is prev. years :: 23 Feb 2015 if (date.diff(today, 'years') < 0) format = 'MMM Do YYYY'; // if posted yesterday: yesterday at 12:00 else if (date.diff(today, 'days') == -1) format = '[yesterday at] HH:mm'; // if posted before then yesterday: 23 Feb at 12:00 else if (date.diff(today, 'days') <= -2) format = 'MMM Do [at] HH:mm'; // if posted today: today at 12:00 else if (date.diff(today, 'minutes') <= -60) format = '[today at] HH:mm';
And minimum in one day time I could see another time format. But what if I'd need to change format, for example, in 10 minutes?
I see, so here are my suggestions:
fullDateThresholdDiff
to fullDateThresholdUnit
then I will happily merge :-)
so?
Thanks Denis, I still haven't had an opportunity to look into it, it's on my list
Looks great, thanks!
Added amFullDateThresholdDiff for changing default. Now every one can choose when need show FullDate.
var daysAgo = getNow().diff(momentInstance, 'day');
to (by default fullDateThresholdDiff is 'day')var timeAgo = getNow().diff(momentInstance, fullDateThresholdDiff);