Skip to content

fix(common): DatePipe doesn't throw for NaN - #14117

Closed
DzmitryShylovich wants to merge 1 commit into
angular:masterfrom
DzmitryShylovich:gh/14103
Closed

DzmitryShylovich wants to merge 1 commit into
angular:masterfrom
DzmitryShylovich:gh/14103

Conversation

@DzmitryShylovich

Copy link
Copy Markdown
Contributor

Fixes #14103

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need cast Number to <any> here? How about using value != value (https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/isNaN)

@dejour dejour Jan 26, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not simply use isNaN(value)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isNaN has false-positives - check the article I've linked.

@DzmitryShylovich DzmitryShylovich Jan 26, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not simply use isNaN(value)?

Because isNaN is broken and to fix it they introduced Number.isNaN in es2015

Why do we need cast Number to here?

because angular doesn't allow to use es2015 types (at least for Object)

How about using value != value

yeah, it's a good option, just not obvious why it's required vs Number.isNaN

@pkozlowski-opensource pkozlowski-opensource added the area: common Issues related to APIs in the @angular/common package label Jan 26, 2017
@pkozlowski-opensource pkozlowski-opensource self-assigned this Jan 26, 2017
@IgorMinar

IgorMinar commented Jan 26, 2017 •

Copy link
Copy Markdown
Contributor

unrelated to this PR, I'm just trying to get hold of Dzmitry: hi @DzmitryShylovich, can you please email me at iminar@google ? thanks

@pkozlowski-opensource

Copy link
Copy Markdown
Member

Related to this PR: LGTM

@pkozlowski-opensource pkozlowski-opensource added pr_state: LGTM action: merge The PR is ready for merge by the caretaker labels Jan 26, 2017
@DzmitryShylovich

Copy link
Copy Markdown
Contributor Author

@IgorMinar I sent you an email

@mhevery mhevery closed this in 7ad616a Jan 27, 2017
mhevery pushed a commit that referenced this pull request Jan 27, 2017
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: common Issues related to APIs in the @angular/common package cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DatePipe milliseconds

5 participants