js 获取每月最后一天

    let y = new Date().getFullYear()
 
    let m = new Date().getMonth() + 1
 
    let lastDay = new Date(y, m, 0).getDate()
 
    console.log('lastDay: ', lastDay); // lastDay:  31
 
    let date = y + '-' + m + '-' + lastDay
 
    console.log('date: ', date); // date:  2022-5-31
posted @ 2022-05-26 13:50  牧羊少年&  阅读(895)  评论(0)    收藏  举报