diff options
author | Antony Shaleynikov <shaleynikov@gmail.com> | 2017-03-01 23:58:06 +0300 |
---|---|---|
committer | Antony Shaleynikov <shaleynikov@gmail.com> | 2017-03-01 23:58:06 +0300 |
commit | 95699887ac75de5dff6bd25278289e31e4745482 (patch) | |
tree | 1d3ba6855fa867e90e380be4312578777736ff73 /examples | |
parent | 19b96283c09e678b8b7ea5c60569996a0bab5935 (diff) | |
download | time-picker-95699887ac75de5dff6bd25278289e31e4745482.tar.gz time-picker-95699887ac75de5dff6bd25278289e31e4745482.tar.zst time-picker-95699887ac75de5dff6bd25278289e31e4745482.zip |
Added 12hours display support
Diffstat (limited to 'examples')
-rw-r--r-- | examples/12hours.html | 0 | ||||
-rw-r--r-- | examples/12hours.js | 30 |
2 files changed, 30 insertions, 0 deletions
diff --git a/examples/12hours.html b/examples/12hours.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/examples/12hours.html | |||
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 | |||
3 | import 'rc-time-picker/assets/index.less'; | ||
4 | |||
5 | import React from 'react'; | ||
6 | import ReactDom from 'react-dom'; | ||
7 | |||
8 | import moment from 'moment'; | ||
9 | |||
10 | import TimePicker from 'rc-time-picker'; | ||
11 | |||
12 | const showSecond = false; | ||
13 | const str = showSecond ? 'HH:mm:ss' : 'HH:mm'; | ||
14 | |||
15 | const now = moment().hour(14).minute(30); | ||
16 | |||
17 | function onChange(value) { | ||
18 | console.log(value && value.format(str)); | ||
19 | } | ||
20 | |||
21 | ReactDom.render( | ||
22 | <TimePicker | ||
23 | showSecond={showSecond} | ||
24 | defaultValue={now} | ||
25 | className="xxx" | ||
26 | onChange={onChange} | ||
27 | show12Hours | ||
28 | />, | ||
29 | document.getElementById('__react-content') | ||
30 | ); | ||