Just solved a mind-boggling problem I was having with some date manipulation.
The Date constructor returns a date with a different timezone depending on whether the date is today & before, or in the future.
var today:Date = new Date();
var yesterday:Date = new Date( today.fullYear, today.month, today.date - 1 );
var today2:Date = new Date( today.fullYear, today.month, today.date );
var tomorrow:Date = new Date( today.fullYear, today.month, today.date + 1 );
trace( yesterday.timezoneOffset );
trace( today2.timezoneOffset );
trace( tomorrow.timezoneOffset );
What's worse if you then subtract a day from "tomorrow" it doesn't equal today.
trace( tomorrow.time == today.time );
trace( tomorrow == today );
Output: false / false
Today's daylight savings switchover day. Arghhh.
I really wish Actionscript had a date-only type.Share on Twitter Share on Facebook