diff options
Diffstat (limited to 'examples/pick-time.js')
-rw-r--r-- | examples/pick-time.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/examples/pick-time.js b/examples/pick-time.js index 70de23d..178b622 100644 --- a/examples/pick-time.js +++ b/examples/pick-time.js | |||
@@ -10,7 +10,10 @@ import zhCn from 'gregorian-calendar/lib/locale/zh_CN'; | |||
10 | import TimePicker from 'rc-time-picker'; | 10 | import TimePicker from 'rc-time-picker'; |
11 | import TimePickerLocale from 'rc-time-picker/src/locale/zh_CN'; | 11 | import TimePickerLocale from 'rc-time-picker/src/locale/zh_CN'; |
12 | 12 | ||
13 | const formatter = new DateTimeFormat('HH:mm:ss'); | 13 | var showSecond = true; |
14 | var str = showSecond ? 'HH:mm:ss' : 'HH:mm'; | ||
15 | |||
16 | const formatter = new DateTimeFormat(str); | ||
14 | 17 | ||
15 | const now = new GregorianCalendar(zhCn); | 18 | const now = new GregorianCalendar(zhCn); |
16 | now.setTime(Date.now()); | 19 | now.setTime(Date.now()); |
@@ -20,6 +23,12 @@ function onChange(value) { | |||
20 | } | 23 | } |
21 | 24 | ||
22 | ReactDom.render( | 25 | ReactDom.render( |
23 | <TimePicker formatter={formatter} locale={TimePickerLocale} defaultValue={now} onChange={onChange}/>, | 26 | <TimePicker formatter={formatter} locale={TimePickerLocale} |
27 | showSecond={showSecond} | ||
28 | defaultValue={now} | ||
29 | onChange={onChange}/>, | ||
24 | document.getElementById('__react-content') | 30 | document.getElementById('__react-content') |
25 | ); | 31 | ); |
32 | |||
33 | |||
34 | console.log(zhCn); \ No newline at end of file | ||