Get the first and last date of the previous month in JQuery

前端 未结 7 801
攒了一身酷
攒了一身酷 2021-02-09 07:41

I have this script,

 var today = new Date();
 var dd = today.getDate();
 var ffffd = today.getDate()-1;
 var ffffdd = today.getDate()-2;

 var mm = today.getMonth()+         


        
7条回答
  •  悲&欢浪女
    2021-02-09 08:14

    Try using bellow

    var date = new Date();
    var monthStartDay = new Date(date.getFullYear(), date.getMonth(), 1);
    var monthEndDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
    

提交回复
热议问题