diff options
-rw-r--r-- | examples/12hours.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/12hours.js b/examples/12hours.js index 16e428d..72d6950 100644 --- a/examples/12hours.js +++ b/examples/12hours.js | |||
@@ -9,22 +9,21 @@ import moment from 'moment'; | |||
9 | 9 | ||
10 | import TimePicker from 'rc-time-picker'; | 10 | import TimePicker from 'rc-time-picker'; |
11 | 11 | ||
12 | const showSecond = false; | 12 | const format = 'h:mm a'; |
13 | const str = showSecond ? 'h:mm a' : 'h:mm a'; | ||
14 | 13 | ||
15 | const now = moment().hour(0).minute(0); | 14 | const now = moment().hour(0).minute(0); |
16 | 15 | ||
17 | function onChange(value) { | 16 | function onChange(value) { |
18 | console.log(value && value.format(str)); | 17 | console.log(value && value.format(format)); |
19 | } | 18 | } |
20 | 19 | ||
21 | ReactDom.render( | 20 | ReactDom.render( |
22 | <TimePicker | 21 | <TimePicker |
23 | showSecond={showSecond} | 22 | showSecond={false} |
24 | defaultValue={now} | 23 | defaultValue={now} |
25 | className="xxx" | 24 | className="xxx" |
26 | onChange={onChange} | 25 | onChange={onChange} |
27 | format={str} | 26 | format={format} |
28 | use12Hours | 27 | use12Hours |
29 | />, | 28 | />, |
30 | document.getElementById('__react-content') | 29 | document.getElementById('__react-content') |