I found a weird bug which happens when i try to select a date in the month february (when its now late march). The setMonth(1) doesn't return february but march (i think this has to do with the order of setting parts of the date object in js. I found that changing the order to :
['seconds', 'minutes', 'hours', 'day', 'month', 'year'].each ... etc works better
var d = new Date(); //today is 30 march 2010
var values = {year:2009,month:1, day:8,hours:12,minutes:34,seconds:17};
['year', 'month', 'day', 'hours', 'minutes', 'seconds'].each(function(type) {
but when setting the day before the month is set from the object the correct date is retrieved. (in this example you will see that after setting the month twice in the case it does go to february (really weird behaviour))