# Pastebin 8xzMXaY8
/* eslint-disable */
import {Button, FormControl, InputGroup} from 'react-bootstrap';
import CustomInput from '../../input';
import DatePicker from 'react-datepicker'
import FontAwesome from 'react-fontawesome';
import PropTypes from 'prop-types';
import React from 'react';
import ValidationLabel from './validation-label';
import classNames from 'classnames';
import {getSeparatedDate} from '../validators/date';
import moment from 'moment';
class DateField extends React.Component {
constructor(props) {
super(props);
const {day, month, year} = this.props.defaultValue;
this.state = {
day: !day ? '' : day,
month: !month ? '': month,
year: !year ? '' : year
};
}
updateDate = (day, month, year) => {
console.log('update date called with ' + 'day-' + day + '-month-' + month + '-year-' + year);
//console.log({year: !year?null:year, month: !month?null:month, day: !day?null:day});
this.props.onChangeDate({year: !year?null:year, month: !month?null:month, day: !day?null:day});
};
handleYearChange = (event) => {
let year = event.target.value;
this.setState({year});
this.updateDate(this.state.day, this.state.month, year);
};
handleMonthChange = (event) => {
let month = event.target.value;
this.setState({month});
this.updateDate(this.state.day, month, this.state.year);
};
handleDayChange = (event) => {
let day = event.target.value;
this.setState({day})
this.updateDate(day, this.state.month, this.state.year);
};
handleChangeOfDatePicker = (value) => {
const date = new Date(value);
const year = date.getFullYear();
const month = date.getMonth()+1;
const day = date.getDate();
this.setState({year});
this.setState({month});
this.setState({day})
console.log('date by date picker '+ value + date.getFullYear() + ' '+ date.getMonth() + ' '+ date.getDate());
this.updateDate(day, month, year);
}
render() {
console.log('error got ' + this.props.error);
console.log('empty got ' + this.props.empty);
const labelElement = (