I am trying to convert a string to a Date object, and it works for all days except for December 31st where by object says December 1st instead of 31st. I have no idea why. Here is my JavaScript code:

var dt = new Date(); dt.setDate("31"); dt.setMonth("11"); dt.setFullYear("2014");

but my variable value is:

Mon Dec 01 2014 11:48:08 GMT+0100 (Paris, Madrid)

If I do the same for any other date, my object returns to the appropriate value. Do you have any idea what I did wrong?