I’m working on an AIR app today and I’m trying to compare my system time with the current time in New York (I’m in California). So the first thing I want to do is to see if the date flipped over already in New York. I compare my local system date with the date coming back from the remote server. Seems pretty simple.
According to Adobe:
http://livedocs.adobe.com/labs/flex3/langref/Date.html
Date() Constructor
- If you pass no arguments, the Date object is assigned the current date and time.
So I create an Date object:
var todaysDate
ate = new Date();
trace(“todaysDate: ” + todaysDate.month + “/” + todaysDate.date + “/” + todaysDate.fullYear);
and the trace comes out as “todaysDate: 2/15/2008″
I’m scratching my head. I’m pretty sure it’s March, so I reboot and check the system date. Sure enough, it’s March. OK…So I start looking around:
http://bugs.adobe.com/jira/browse/SDK-14658
“Not a bug. Dates in ActionScript are zero based. For more information, see: http://livedocs.adobe.com/labs/flex3/langref/mx/controls/DateChooser.html#displayedMonth“
Now this might not be a *bug*, but it’s freakin‘ STOOPID. The days aren’t zero based. Why should the months be? I don’t where these guys grew up, but since when has January been month zero? Apparently on Planet Adobe January 1, 2008 is annotated 1/0/2008. Makes perfect sense to me.
I guess I’ve never run into this before because every time I’ve used the Date() it’s been relative…relatively WRONG.
Come on, guys…why should I have to write extra code to try to figger out the MONTH on my local computer?