Why does this return the 31st instead of the 1st? . As I understand it, the UTC method requires 3 parameters (full year, month, day), and the day parameter must be an integer from 1 to 31. Since getDate() returns with an integer from 0 to 31, I also suspect that 0 it will be an opportunity.
firstDay = new Date(Date.UTC( 2011 , 7 , 1 )).getDate();
Let me clarify and say that this is not a special case. If the day parameter is 2, 3 or 4, this will return 1, 2, 3, etc.
source share