I wanted to get some input on this. I'm writing a DateTime object using
Proxy, (for all of the timezone stuff I'm working on) and I'm a little
annoyed trying to make the DateTime constructor work exactly like the Date
constructor.
Here's my code... commented out code was other attempts:
public function DateTime(... args)
{
super();
// var yearOrTimevalue:Object = args[0];
// trace(getQualifiedClassName(yearOrTimevalue));
_item = new Date(... args);
// Adobe PLEASE add native overloaded constructor support! even though this
works, doing crap like this makes me feel dirty.
/* switch(args.length) {
case 0:
_item = new Date();
break;
case 1:
_item = new Date(args[0]);
break;
case 2:
_item = new Date(args[0], args[1]);
break;
case 3:
_item = new Date(args[0], args[1], args[2]);
break;
case 4:
_item = new Date(args[0], args[1], args[2], args[3]);
break;
case 5:
_item = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
case 6:
_item = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case 7:
_item = new Date(args[0], args[1], args[2], args[3], args[4], args[5],
args[6]);
break;
} */
/* if(args.length == 0)
{
_item = new Date();
}
else if (args.length == 1)
{
_item = new Date(args[0]);
}
else
{
_item = new Date(args[0], args[1], args[2]);
} */
/* if(yearOrTimevalue is String) // Handle String
{
_item = new Date(yearOrTimevalue);
}
else if (yearOrTimevalue is Number) // Handle Number
{
_item = new Date(yearOrTimevalue);
}
else if (yearOrTimevalue is int) // Handle Int
{
if(yearOrTimevalue
_item = new Date(yearOrTimevalue, month, date, hour, minute, second,
millisecond);
}
else if (!yearOrTimevalue) // Handle null
{
_item = new Date();
}
else
{
_item = new Date("invalid");
} */
trace("DateTime constructed");
}
I really wish I could just pass the argument string straight through, using
something like, "_item = new Date(... args); ", but I get the error:
1199: RestExpressionNode not yet implemented
This makes my heart sad.
Doing some research I found this forum post:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid=1394047
Anyone have any ideas?
--
Cheers,
Nate
----------------------------------------
http://blog.natebeck.net