1.获取当前月第一天
// 获取当前月第一天
export function getCurrentMonthFirst() {
var date = new Date();
date.setDate(1);
return new Date(new Date(date).toLocaleDateString()).getTime()
}
2.获取最后一天
// 获取当前月最后一天
export function getCurrentMonthLast() {
var date = new Date();
var currentMonth = date.getMonth();
var nextMonth = ++currentMonth;
var nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1);
var oneDay = 1000 * 60 * 60 * 24;
return (new Date(nextMonthFirstDay - oneDay).getTime()) + 24 * 60 * 60 * 1000 - 1
}
标签:02,00,date,09,60,var,Date,new
From: https://www.cnblogs.com/hutongtree/p/16648838.html