PDA

View Full Version : Can't setMaxValue for DatePicker to a past date



phamtranquocviet
30 May 2009, 12:42 PM
Hi,

I want to set max date for my birthday date picker to 18 years ago using this code, but it disables all dates.


Date eighteenYearsAgo = new Date((new DateWrapper().addYears(-18)).getTime());
birthday.setMaxValue(eighteenYearsAgo);

However, settting it to today's date as followed works.


birthday.setMaxValue(new Date());

Debugger shows eighteenYearsAgo and new Date() have the same date format.

What am I missing? Thanks for your help.