Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing null check in pipe: Wrong parameter in TimeagoPipe #45

Open
BojanKogoj opened this issue Sep 10, 2020 · 0 comments
Open

Missing null check in pipe: Wrong parameter in TimeagoPipe #45

BojanKogoj opened this issue Sep 10, 2020 · 0 comments

Comments

@BojanKogoj
Copy link

BojanKogoj commented Sep 10, 2020

Current behavior

Pipe crashes when value is missing

ERROR SyntaxError: Wrong parameter in TimeagoPipe. Expected a valid date, received: null

This will happen while you wait for content to load

{{ item?.createdAt | timeago }}

This will most likely happen during testing, when you don't mock whole object.

Expected behavior

Display nothing

How do you think that we should fix this?

Add null check

Minimal reproduction of the problem with instructions

{{ '' | timeago}}
{{ undefined | timeago}}
{{ null | timeago}}

Environment


ngx-timeago version: ^1.0.4
Angular version: 10.0.12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant