function getCurrentMonth () {
  var currentDate = new Date();
  const year = currentDate.getFullYear();
  const month = currentDate.getMonth() + 1;
  var currentMonth = `${year}-${month}`; // 注意要加1，月份是从0开始计数的
  return currentMonth;
}

function getCurrentDate () {
  var currentDate = new Date();
  const year = currentDate.getFullYear();
  const month = currentDate.getMonth() + 1;
  const day = currentDate.getDate();

  var currentDateOfMonth = `${year}-${month}-${day}`;
  return currentDateOfMonth;
}

function getCurrentMonthRange () {
  var currentDate = new Date();
  var currentYear = currentDate.getFullYear();
  var currentMonth = currentDate.getMonth();
  var firstDayOfMonth = new Date(currentYear, currentMonth, 1);
  // var today = currentDate.getDate();

  var rangeStart = firstDayOfMonth.toLocaleDateString(); // 当月1号的日期
  var rangeEnd = currentDate.toLocaleDateString(); // 当前日期
  // var regex = /(\d{4})\/(\d{1,2})\/(\d{1,2})/;
  var oldnowtimerange = [rangeStart, rangeEnd];
  var newnowtimerange = []
  for (let i = 0; i < oldnowtimerange.length; i++) {
    const dateParts = oldnowtimerange[i].split('/');
    const year = parseInt(dateParts[0]);
    const month = parseInt(dateParts[1]);
    const day = parseInt(dateParts[2]);

    const convertedDate = new Date(year, month - 1, day);
    const formattedYear = convertedDate.getFullYear();
    const formattedMonth = convertedDate.getMonth() + 1;
    const formattedDay = convertedDate.getDate();

    const formattedDate = `${formattedYear}-${formattedMonth}-${formattedDay}`;
    newnowtimerange.push(formattedDate);

  }
  return newnowtimerange


  // return [rangeStart,
  //   rangeEnd]


}
export const nowmonthy = getCurrentMonth()
export const nowdate = getCurrentDate()
export const nowdaterange = getCurrentMonthRange()