-
Notifications
You must be signed in to change notification settings - Fork 172
/
app.js
45 lines (40 loc) · 1.03 KB
/
app.js
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
38
39
40
41
42
43
44
45
import '../src/less/input-moment.less';
import './app.less';
import moment from 'moment';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import InputMoment from '../src/input-moment';
import packageJson from '../package.json';
class App extends Component {
state = {
m: moment()
};
handleChange = m => {
this.setState({ m });
};
handleSave = () => {
console.log('saved', this.state.m.format('llll'));
};
render() {
return (
<div className="app">
<h1>
{packageJson.name}: {packageJson.version}
</h1>
<h2>{packageJson.description}</h2>
<form>
<div className="input">
<input type="text" value={this.state.m.format('llll')} readOnly />
</div>
<InputMoment
moment={this.state.m}
onChange={this.handleChange}
minStep={5}
onSave={this.handleSave}
/>
</form>
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById('app'));