-
Notifications
You must be signed in to change notification settings - Fork 1
/
Start.jsx
37 lines (33 loc) · 930 Bytes
/
Start.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { setSessionStart } from '../../../actions/sessionActions';
const mapDispatchToProps = dispatch => {
return {
setSessionStart: name => dispatch(setSessionStart(name))
};
};
/**
* Implementation for DatePicker Fabric for start date
*/
class StartDatePicker extends Component {
constructor(props) {
super(props);
this.state = {
date: this.props.converter(new Date().toLocaleString())
};
}
render() {
return(
<div className="input">
<span className="inputName">{this.props.lable}</span>
<input
className="inputInline"
type='datetime-local'
value={this.state.date}
onChange={value => this.setState({ date: value.currentTarget.value }, () => this.props.setSessionStart(new Date(this.state.date)))}
/>
</div>
);
}
}
export default connect(null, mapDispatchToProps)(StartDatePicker);