const today = {
  text: '今天',
  onClick (picker) {
    const end = new Date()
    const start = new Date()
    start.setHours(0, 0, 0, 0)
    end.setHours(23, 59, 59, 999)
    picker.$emit('pick', [start, end])
  }
}

const yesterday = {
  text: '昨天',
  onClick (picker) {
    const end = new Date()
    const start = new Date()
    start.setTime(start.getTime() - 3600 * 1000 * 24)
    end.setTime(end.getTime() - 3600 * 1000 * 24)
    start.setHours(0, 0, 0, 0)
    end.setHours(23, 59, 59, 999)
    picker.$emit('pick', [start, end])
  }
}
const week = {
  text: '最近7日',
  onClick (picker) {
    const end = new Date()
    const start = new Date()
    start.setTime(start.getTime() - 3600 * 1000 * 24 * 6)
    start.setHours(0, 0, 0, 0)
    end.setHours(23, 59, 59, 999)
    picker.$emit('pick', [start, end])
  }

}

const month = {
  text: '最近30日',
  onClick (picker) {
    const end = new Date()
    const start = new Date()
    start.setTime(start.getTime() - 3600 * 1000 * 24 * 29)
    start.setHours(0, 0, 0, 0)
    end.setHours(23, 59, 59, 999)
    picker.$emit('pick', [start, end])
  }
}

const twoMonths = {
  text: '最近60日',
  onClick (picker) {
    const end = new Date()
    const start = new Date()
    start.setTime(start.getTime() - 3600 * 1000 * 24 * 59)
    start.setHours(0, 0, 0, 0)
    end.setHours(23, 59, 59, 999)
    picker.$emit('pick', [start, end])
  }
}
const threeMonths = {
  text: '最近90日',
  onClick (picker) {
    const end = new Date()
    const start = new Date()
    start.setTime(start.getTime() - 3600 * 1000 * 24 * 89)
    start.setHours(0, 0, 0, 0)
    end.setHours(23, 59, 59, 999)
    picker.$emit('pick', [start, end])
  }
}

export {
  today,
  yesterday,
  week,
  month,
  twoMonths,
  threeMonths
}
