fix (date filter): added !isNaN check before creating new Date object#15010
fix (date filter): added !isNaN check before creating new Date object#15010plong0 wants to merge 1 commit into
Conversation
LOL - That is hardly a problem. The real problem is for people not using Safari and expecting a var value = NaN; // some numeric value that can also be NaN
var date = dateFilter(value);
if (date.getTime() > someThreshold) {
// Do this and that...
}Before this change, the above snippet will work ( |
|
Tbh, I don't think the benefits of this justify the cost. The benefits are that we work-around one specific case (among several) of a bug in one specific browser. I don't think many apps will be affected by this, but people upgrading will nevertheless have to go through the whole codebase checking for situations where a value passed to I don't feel too strongly though. Let's see what others think. |
|
A agree with @gkalpak |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix
What is the current behavior? (You can also link to an open issue here)
Please see: #13415 (comment)
not solved by PR #14221 in release 1.4.12 or 1.5.8
What is the new behavior (if this is a feature change)?
Perform
!isNaN(date)check in date filter before attempting to createnew Date(date)object.Does this PR introduce a breaking change?
Possibly. If a user of the date filter expects it to throw the DateRange error if a
NaNvalue is passed.Please check if the PR fulfills these requirements
Other information:
Workaround is simple enough to pass values through a normalization filter before passing to date filter.