// 数组排序降序
export function compare (property) {
  return function(a, b){
    var value1 = a[property];
    var value2 = b[property];
    return value2 - value1;
  }
}

// 获取当前的月-日
export function getDate () {
  const date = new Date()
  let month = date.getMonth() + 1
  month = month < 10 ? '0' + month : month
  let day = date.getDate()
  day = day < 10 ? '0' + day : day
  return month + '-' + day
}

// 获取当前的年月日
export function getFullDate () {
  const date = new Date()
  let year = date.getFullYear()
  let month = date.getMonth() + 1
  month = month < 10 ? '0' + month : month
  let day = date.getDate()
  day = day < 10 ? '0' + day : day
  return year + '-' + month + '-' + day
}

// 获取当前时间七天前的年月日
export function getSevenPassDate () {
  let date = new Date(new Date().getTime() - 1000 * 3600 * 24 * 7)
  let year = date.getFullYear()
  let month = date.getMonth() + 1
  month = month < 10 ? '0' + month : month
  let day = date.getDate()
  day = day < 10 ? '0' + day : day
  return year + '-' + month + '-' + day
}