aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/12hours.js
diff options
context:
space:
mode:
Diffstat (limited to 'examples/12hours.js')
-rw-r--r--examples/12hours.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/12hours.js b/examples/12hours.js
new file mode 100644
index 0000000..18fb626
--- /dev/null
+++ b/examples/12hours.js
@@ -0,0 +1,30 @@
1/* eslint no-console:0 */
2
3import 'rc-time-picker/assets/index.less';
4
5import React from 'react';
6import ReactDom from 'react-dom';
7
8import moment from 'moment';
9
10import TimePicker from 'rc-time-picker';
11
12const showSecond = false;
13const str = showSecond ? 'HH:mm:ss' : 'HH:mm';
14
15const now = moment().hour(14).minute(30);
16
17function onChange(value) {
18 console.log(value && value.format(str));
19}
20
21ReactDom.render(
22 <TimePicker
23 showSecond={showSecond}
24 defaultValue={now}
25 className="xxx"
26 onChange={onChange}
27 show12Hours
28 />,
29 document.getElementById('__react-content')
30);