views:

87

answers:

1

Hi

I'm not sure whether it's a bug or what. But it's making my life worse.

I'm doing a Flex 4 application that has a calendar component in an invisible 'state' when I pass comp2.selectedDate(2006,2); and debug at line 3, date has only 2006 year and 0 month.

Why so? Why isn't it getting month = 2 as well?

Thanks in advance

public function selectedDate(year:Number, month:Number, day:* = null):void{
var date:Date = new Date(year, month, day);
dateChooser.selectedDate = date;
}
+2  A: 

Wow, everything looks in order here. The only possible issue I see is passing in null for the day when creating a new Date. The default is 1, you may want to try setting the day to 1 when you detect null being passed into your method for the day. Hope that helps.

Wade Mueller
Thanks a lot Wade :)
Max
@Wade. Good catch. Perhaps a better option would be changing the signature of the method to accept a Number for the day and make it default to 1. `public function selectedDate(year:Number, month:Number, day:Number = 1):void`
Juan Pablo Califano