import {formatYMD} from '@/common/filters/custom.js';

export default {
  data() {
    return {
      // dateKey: 0,
      dateDefault: [],
      pickerOptions() {
        // let pickerMinDate;
        return {
          onPick(obj) {
            // pickerMinDate = obj.minDate;
          },
          disabledDate(time) {
            let start = new Date();
            start.setFullYear(start.getFullYear() - 2);
            start.setDate(start.getDate() + 1);
            start = new Date(`${start.getFullYear()}-${start.getMonth() + 1}-${start.getDate()}`);
            let end = new Date();
            end = new Date(`${end.getFullYear()}-${end.getMonth() + 1}-${end.getDate()} 23:59:59`);
            return time.getTime() < start.getTime() || time.getTime() > end;
          }
        };
      }
    };
  },
  methods: {
    setDefalutTime(){
      let start = new Date();
      start.setFullYear(start.getFullYear());
      start.setDate(start.getDate() + 1);
      start = `${start.getFullYear()}-${start.getMonth() + 1}-${start.getDate()}`;
      let end = new Date();
      end = `${end.getFullYear()}-${end.getMonth() + 1}-${end.getDate()}`;
      this.dateDefault = [formatYMD(new Date(end).getTime()), formatYMD(new Date(start).getTime())]
    },
  }
};