import React from "react"; import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import FormGroup from "reactstrap/lib/FormGroup"; import ms from "ms"; import { Component } from "react"; class TmtDate extends Component { constructor(props) { super(props); const tmt_awal = new Date(); this.state = { startDay: tmt_awal, maxDay: new Date(+new Date(tmt_awal) + ms("180d")), isiTmt: "", }; } render() { return (
{ this.setState({ isiTmt: e }); this.props.setTmt({ startDate: this.state.startDay, endDate: this.state.isiTmt }); }} dateFormat="dd/MM/yyyy" minDate={this.state.startDay} maxDate={this.state.maxDay} placeholderText="isi TMT" // maxDate={addDays(new Date(), 5)} /> Max pengisian TMT 6 bulan
{moment(this.state.startDay).format("DD-MM-YYYY")} hingga {this.state.isiTmt ? moment(this.state.isiTmt).format("DD-MM-YYYY") : "-"}
); } } export default TmtDate;