var _excluded = ["year", "month"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React, { useMemo } from 'react';
import { Calendar } from 'antd';
import "./styles/index.less";
// moment与dayjs不能同时使用，不然locale配置会无效
// import moment from 'moment'
//去除RFC2822/ISO date formats的警告
// moment.suppressDeprecationWarnings = true;
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
dayjs.locale('zh-cn');
var CalendarMonthPicker = function CalendarMonthPicker(props) {
  var year = props.year,
    month = props.month,
    others = _objectWithoutProperties(props, _excluded);
  var monthRangeDays = useMemo(function () {
    var time = (year || dayjs().year()) + '-01';
    var startTime = dayjs(time).month(month - 1).date(1).startOf("month"); //.format('YYYY-MM-DD')
    var endTime = dayjs(time).month(month - 1).date(1).endOf("month"); //.format('YYYY-MM-DD')
    return [startTime, endTime];
  }, [year]);
  // dayjs.locale('zh-cn')
  return /*#__PURE__*/React.createElement(Calendar, _extends({
    fullscreen: false,
    value: dayjs((year || dayjs().year()) + '-' + month),
    validRange: monthRangeDays
  }, others));
};
export default CalendarMonthPicker;