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); }

import React from "react";
import Datepicker from "../Datepicker";
import { dateFormat } from "../../dateTimeFormat";
import componentGroups from "../../../../docs-utils/componentGroups";
import componentCategories from "../../../../docs-utils/componentCategories";
export default class Datepicker__default extends React.Component {
  constructor(props) {
    super(props);
    let date = new Date();
    console.log(date, typeof date);
    this.state = {
      month: date.getMonth(),
      date: date.getDate(),
      year: date.getFullYear(),
      day: date.getDay()
    };
    this.onSelectDate = this.onSelectDate.bind(this);
    this.setYear = this.setYear.bind(this);
    this.setMonth = this.setMonth.bind(this);
  }

  setYear(year) {
    this.setState({
      year: year
    });
  }

  setMonth(month) {
    this.setState({
      month: month
    });
  }

  onSelectDate(data) {
    console.log(data);
    this.setState({
      date: data.date,
      year: data.year,
      month: data.month,
      day: data.day
    });
  }

  render() {
    let {
      date,
      month,
      day,
      year
    } = this.state;
    return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, `${date}-${month}-${year}`, this.props.dayNames[day]), /*#__PURE__*/React.createElement(Datepicker, _extends({}, this.props, this.state, {
      selectYear: this.setYear,
      selectMonth: this.setMonth,
      onSelectDate: this.onSelectDate
    })));
  }

}
Datepicker__default.defaultProps = {
  dataId: "dateWidget",
  dayNames: dateFormat().dayNames,
  dayNamesShort: dateFormat().dayNamesShort,
  monthNames: dateFormat().monthNames,
  monthNamesShort: dateFormat().monthNamesShort
};
Datepicker__default.docs = {
  componentGroup: componentGroups.Components,
  folderName: componentCategories.UCL
};