You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by "Justin Mclean (JIRA)" <ji...@apache.org> on 2013/04/18 02:13:16 UTC
[jira] [Commented] (FLEX-24691) ObjectUtil.dateCompare does not
handle an invalid date object
[ https://issues.apache.org/jira/browse/FLEX-24691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13634661#comment-13634661 ]
Justin Mclean commented on FLEX-24691:
--------------------------------------
Confirmed still an issue.
> ObjectUtil.dateCompare does not handle an invalid date object
> -------------------------------------------------------------
>
> Key: FLEX-24691
> URL: https://issues.apache.org/jira/browse/FLEX-24691
> Project: Apache Flex
> Issue Type: Bug
> Components: .Unspecified - Framework
> Affects Versions: Adobe Flex SDK 4.1 (Release)
> Environment: Affected OS(s): Mac
> Affected OS(s): Mac OS 10.6
> Browser: Firefox 3.x
> Language Found: English
> Reporter: Adobe JIRA
> Assignee: Justin Mclean
> Labels: easyfix, easytest
>
> Steps to reproduce:
> 1. Create an invalid Date object: var a:Date = new Date(Date.parse(""))
> 2. Create a valid Date Object: var b:Date = new Date()
> 3. Compare these dates: ObjectUtil.dateCompare(a,b);
>
> Actual Results:
> The comparison returns 0. This is because dateCompare uses Date.getTime() to compare values, and a.getTime() returns NaN which is neither less than nor greater than a valid number. However, it is also not equal, which is the assumption in dateCompare().
>
> Expected Results:
> either 1 or -1
>
> Workaround (if any):
> Be careful in your code to not pass such a Date into ObjectUtil.dateCompare().
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira