问题复现 new Date()之后使用setMonth()函数,某些月份得到非预期结果,如图: 问题解决 new Date()之后立刻调用setDate(1)把日期设置为1号,后面的setMonth()、setDate()操作正常: