日期操作
new Date().getMonth()得到的月份是从0开始的new Date(year, month, day)
// Thu Oct 31 2019 00:00:00 GMT+0800,这个getMonth(),得到的是9(0起始)
new Date(2019, 10, 0)
// Fri Nov 01 2019 00:00:00 GMT+0800,这个getMonth(),得到的是10(0起始)
new Date(2019, 10, 1)
- 获取的是
month月(从1开始)的最大天数new Date(year, month, 0).getDate()