在使用之前进行判断就吧问题解决了
if (Object.prototype.toString.call(time) === '[object Date]') {
  time.getMonth()........
}

相关文章: