diff options
author | Antony Shaleynikov <shaleynikov@gmail.com> | 2017-03-06 17:56:48 +0300 |
---|---|---|
committer | Antony Shaleynikov <shaleynikov@gmail.com> | 2017-03-06 17:56:48 +0300 |
commit | 5423edb11fac7f8ed5d35ba739878ee4435fa5af (patch) | |
tree | 248500f50c3783a8bd3837c33d97fde5a3f83a0c /examples | |
parent | c1b40cabff82ed1b7a24fd9baf74e7a8e64119e5 (diff) | |
download | time-picker-5423edb11fac7f8ed5d35ba739878ee4435fa5af.tar.gz time-picker-5423edb11fac7f8ed5d35ba739878ee4435fa5af.tar.zst time-picker-5423edb11fac7f8ed5d35ba739878ee4435fa5af.zip |
Fixing formatting in 12hours example
Diffstat (limited to 'examples')
-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') |