Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Date filter breaks consistency with Angular #10640

Closed
ilanbiala opened this issue Jan 4, 2015 · 3 comments
Closed

Date filter breaks consistency with Angular #10640

ilanbiala opened this issue Jan 4, 2015 · 3 comments

Comments

@ilanbiala
Copy link

If I have something like this {{day | date:'mediumDate'}} where day could be an empty string '', angular is supposed to produce nothing for invalid values. However, I see undefined NaN, NaN, which goes against Angular's consistent "if the input is invalid, Angular won't throw errors, it will just output nothing." Is that not the case for the date filter?

How can I still get an empty string '' to be outputted? Do I have to add a conditional inside the expression?

@lgalfaso
Copy link
Contributor

lgalfaso commented Jan 4, 2015

I cannot reproduce the issue mentioned here http://plnkr.co/edit/sICy9FhJ2mWbkNvhw5pv?p=preview
Would it be possible to have a plunker that shows the issue?

@ilanbiala
Copy link
Author

@lgalfaso sorry the issue is actually when day is an invalid date such as new Date('abc').

@ilanbiala
Copy link
Author

@pkozlowski-opensource @lgalfaso thanks for the quick help!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants