import React from 'react';
import * as actions from './actions.js';
import { connect } from 'react-redux';
import ReactDatetime from 'react-datetime';

class TimeInputComponent extends React.Component {
    render() {
		console.log(this.props);
        return (
            <ReactDatetime
                inputProps ={{
                    placeholder : 'Select time',
                    className : 'DatePickerInput'
                }}
                className = 'DatePicker'
                onChange = {(val) => {this.props.setScheduleTime(val);this.props.extractCronExpression()}}
                dateFormat={false}
                timeFormat="LT"
                value = {this.props.ScheduleTime}
            />
        );
    }
}

const mapStateToProps = (state) =>{
	console.log("****** TimeInputComponent.js state:", state.toJS());
	return {
		RepeatOnWeekDays:state.get('whenReducer').get('RepeatOnWeekDays'),
		RepeatOnWeekDayData:state.get('whenReducer').get('RepeatOnWeekDayData').toJS()
	}
}

export default connect(mapStateToProps,actions)(TimeInputComponent)