Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Adobe Flex SDK 3.0 (Release)
-
None
-
None
-
Affected OS(s): All OS Platforms
Affected OS(s): All OS Platforms
Browser: Internet Explorer 7.x
Language Found: English
Description
Problem:
Currently the DateFormatter class provides the ability to go from an ActionScript Date to a formatted string, but not from a formatted string to an ActionScript Date.
This issue can be found in the system as imported bug SDK-644 from (Planning) SDK 3.0 Candidates, but the issue doesn't contain a discription and was deferred without description.
Solution:
Make DateFormatter.parseDateString() public.
Example:
//date to string
var date:Date = new Date();
var formatter:DateFormatter = new DateFormatter();
formatter.formatString = "MM/DD/YYYY L:NN A";
trace(formatter.format(date));
//string to date works, but only if parseDateString is public
var formatter:DateFormatter = new DateFormatter();
formatter.formatString = "YYYY-MM-DDTHH:NN:SS.000";
var date:Date = DateFormatter.parseDateString(text);
//It would be more consitent though with date to string if the parseDateString were not static:
var formatter:DateFormatter = new DateFormatter();
formatter.formatString = "YYYY-MM-DDTHH:NN:SS.000";
var date:Date = formatter.parseDateString(text);
Workaround (if any):
Create a class that extends DateFormatter that exposes parseDateString()