angular-timeago icon indicating copy to clipboard operation
angular-timeago copied to clipboard

Suppress output when date is null, instead of "NaN years ago"

Open momander opened this issue 7 years ago • 1 comments

If I put this in a template

{{row.timestamp | timeAgo}}

and row.timestamp is null or the property doesn't exist, the output is "NaN years ago". In my opinion that output is never intended by the developer or helpful for the user.

Instead, I propose the output should be null or an empty string. This would be analogous to what happens for null values if you do not use timeAgo. If row.timestamp is null and the template contains

{{row.timestamp}}

the output is empty.

Implementing this would also be useful for developers who want to leave some cells in a table empty, when there is no meaningful date to display for a particular row.

For example, a web-based game may have an Achievements page with a table with the columns "Name" and "Unlocked date". The unlocked achievements in the table would have dates in the second column, but the locked achievements would not.

momander avatar Jul 30 '17 17:07 momander

I have this same challenge!

epugh avatar Dec 18 '20 18:12 epugh