Skip to content

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

@momander

Description

@momander

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions