// 内库使用-start
import LocaleUtil from "./../../../utils/LocaleUtil";
import DateUtil from "./../../../utils/DateUtil";
// 内库使用-end

/* 测试使用-start
import { LocaleUtil, DateUtil } from 'seedsui-react'
测试使用-end */

// 是否为禁用日期
function isDisabledDate(date, _ref) {
  var min = _ref.min,
    max = _ref.max;
  if (date instanceof Date === false) {
    var errDate = new Date();
    return {
      errCode: 'CALENDAR_INVALID_DATE',
      errMsg: LocaleUtil.locale("\u975E\u6CD5\u7684\u65E5\u671F\u683C\u5F0F", 'SeedsUI_date_format_error'),
      date: errDate
    };
  }
  if (min instanceof Date && date.setHours(0, 0, 0, 0) < min.setHours(0, 0, 0, 0)) {
    return {
      errCode: 'CALENDAR_MIN_ERROR',
      errMsg: LocaleUtil.locale("\u7981\u6B62\u8BBF\u95EE\u5C0F\u4E8E".concat(DateUtil.format(min, 'YYYY年MM月DD日')), 'SeedsUI_access_min_error', [DateUtil.format(min, 'YYYY年MM月DD日')]),
      date: min
    };
  }
  if (max instanceof Date && date.setHours(0, 0, 0, 0) > max.setHours(0, 0, 0, 0)) {
    return {
      errCode: 'CALENDAR_MAX_ERROR',
      errMsg: LocaleUtil.locale("\u7981\u6B62\u8BBF\u95EE\u5927\u4E8E".concat(DateUtil.format(max, 'YYYY年MM月DD日')), 'SeedsUI_access_max_error', [DateUtil.format(max, 'YYYY年MM月DD日')]),
      date: max
    };
  }
  return false;
}
export default isDisabledDate;