获取上月最后一天

    var year = new Date().getFullYear();
    var month = new Date().getMonth();
    var nowDate = new Date(year,month,0);   //最后一个参数为0,意为获取2018年10月一共多少天
    var lastDay = nowDate.getDate();  //31
原文地址:https://www.cnblogs.com/hzx-5/p/11045519.html