[ https://issues.apache.org/jira/browse/FLEX-13758?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Mclean resolved FLEX-13758. ---------------------------------- Resolution: Not A Problem getDate function is incorrectly parsing date string not a Apache Flex SDK issue. > Invalid Date object result > -------------------------- > > Key: FLEX-13758 > URL: https://issues.apache.org/jira/browse/FLEX-13758 > Project: Apache Flex > Issue Type: Bug > Components: mx: DateField > Affects Versions: Adobe Flex SDK 3.1 (Release) > Environment: Affected OS(s): Windows > Affected OS(s): > Language Found: English > Reporter: Adobe JIRA > > Steps to reproduce: > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > width="100%" height="100%" creationComplete="onComplete()"> > <mx:Script> > <![CDATA[ > import mx.controls.Alert; > > public static function getDate(str:String):Date{ > function v(value:String):String{ > return (v != null) ? value : '0'; > }; > if(str && str.indexOf('-') != -1){ > var a:Array = str.split('-'); > return new Date(v(a.shift()), > v(a.shift()) - 1, v(a.shift()), v(a.shift()), v(a.shift()), v(a.shift())); > } > return null; > } > > private function onComplete():void{ > var date1:Date = getDate("2006-08-28-08-10-30"); > var date2:Date = > getDate("2006-08-28T08:10:30-00:00"); //Pass invalid date format (Java Date) > if(date1 is Date) Alert.show("Flex 2 SDK date > is:"+ date1); > if(date2 is Date) Alert.show("Flex 2 SDK date > is:"+ date2); > } > ]] > > > </mx:Script> > </mx:Application> > > Actual Results: > You will see two alerts: > Flex 2 SDK date is: Thu Jun 28 08:10:30 GMT-0800 2006 > Flex 2 SDK date is: Invalid Date > > Expected Results: > > Parser format exception; > or > reutrn null; > Workaround (if any): > -- 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