"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _datePicker = _interopRequireDefault(require("antd/lib/date-picker"));
var _moment = _interopRequireDefault(require("moment"));
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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 range(start, end) {
  var result = [];
  for (var i = start; i < end; i++) {
    result.push(i);
  }
  return result;
}
var MyDatePicker = function MyDatePicker(props) {
  var disabledTime = function disabledTime(current) {
    if ((0, _moment["default"])(current).isBefore((0, _moment["default"])(), 'date')) {
      return {};
    }
    var hour = (0, _moment["default"])().hour();
    return {
      disabledHours: function disabledHours() {
        return range(hour + 1, 24);
      },
      disabledMinutes: function disabledMinutes() {
        return range(1, 60);
      }
    };
  };
  return /*#__PURE__*/_react["default"].createElement(_datePicker["default"], _extends({}, props, {
    showTime: true,
    format: 'YYYY-MM-DD HH:mm',
    disabledDate: function disabledDate(current) {
      return current && current > (0, _moment["default"])().endOf('day');
    },
    disabledTime: disabledTime
  }));
};
var _default = exports["default"] = MyDatePicker;
//# sourceMappingURL=MyDatePicker.js.map
