Most modern browsers accept ISO 8601 within the date construtor. All you need to do is calculate the difference between now and then in minutes.
function isLessThan10MinAgo( date ) {
return 0|(new Date() - new Date( date )) * 1.67e-5 <= 10;
}
// Current time: 22:52
console.log( isLessThan10MinAgo('2012-12-11T22:48:00-05:00')); //=> true
console.log( isLessThan10MinAgo('2012-12-11T22:12:00-05:00')); //=> false
Explanation:
0| // floor the result
(new Date() - new Date( date ) // obtain difference between now and then in ms.
* 1.67e-5 // convert to aprox. minutes
<= 10 // return whether is less than 10 min
Usage:
$('abbr.timeago').each(function() {
if ( isLessThan10MinAgo( $(this).attr('title') ) ) {
$(this).after('<span class="new">New!</span>');
}
});