import isDisabledDate from "./isDisabledDate";

// 获取当前绘制日期
function formatDrawDate(newValue, _ref) {
  var min = _ref.min,
    max = _ref.max;
  var newDrawDate = newValue;
  if (Array.isArray(newValue) && newValue.length === 2) {
    newDrawDate = newValue[0];
  }
  if (newDrawDate instanceof Date === false) {
    newDrawDate = new Date();
  }

  // 访问禁止日期
  var error = isDisabledDate(newDrawDate, {
    min: min,
    max: max
  });
  if (error) {
    console.log(error === null || error === void 0 ? void 0 : error.errMsg);
    return error.date;
  }
  return newDrawDate;
}
export default formatDrawDate;