I would like to find an actionscript library that can take strings like:
and parse them into duration (returning the time in some unit).
It seems like it's been done so many times before and I'd hate to implement such a thing myself.
If not in actionscript then in python (I can run this on the server side I guess).
(please notice I'm looking for parsing, not formatting..)
Just for the record, Javascript will not work in Flex directly.Im sure you know this.
Now datejs is a really cool library.What you should really do is, use the advantages of JS in AS using the externalInterface class.
Use the following code in AS3, and make sure to include datejs.js , in the html wrapper, in which this AS3 generated swf will be used.
//--------CODE IN AS-----------------//
public function returnDate(date:String):void
{
Alert.show(date);
}
ExternalInterface.addCallback("returnDate",returnDate);
public function parseDate(userInputString:String):void
{
ExternalInterface.call("parseStringByUser",userInputString);
}
//------------CODE IN JS----------------//
function parseStringByUser(userInputString)
{
var parsedDate= Date.parse(userInputString);
//the line below calls the AS3 function , as AS3 itself exposed it using the ExternalInterface.
returnDate(parsedDate);
}
For externalInterface details you can view : http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With