aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/disabled.js
diff options
context:
space:
mode:
authorMG12 <wuzhao.mail@gmail.com>2015-12-13 00:03:19 +0800
committerMG12 <wuzhao.mail@gmail.com>2015-12-13 00:03:19 +0800
commit0e62bf0b7bdc260e882fd185492939cbaed04d56 (patch)
tree84f678a775ead7577fdcac9089ca918b4febcf39 /examples/disabled.js
parent518b852e8bd9c50a6c5c7e84cddecb5c94ebb5b6 (diff)
downloadtime-picker-0e62bf0b7bdc260e882fd185492939cbaed04d56.tar.gz
time-picker-0e62bf0b7bdc260e882fd185492939cbaed04d56.tar.zst
time-picker-0e62bf0b7bdc260e882fd185492939cbaed04d56.zip
update test case and fix bugs
Diffstat (limited to 'examples/disabled.js')
-rw-r--r--examples/disabled.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/disabled.js b/examples/disabled.js
new file mode 100644
index 0000000..24d0068
--- /dev/null
+++ b/examples/disabled.js
@@ -0,0 +1,36 @@
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 GregorianCalendar from 'gregorian-calendar';
9import DateTimeFormat from 'gregorian-calendar-format';
10import zhCn from 'gregorian-calendar/lib/locale/zh_CN';
11
12import TimePicker from 'rc-time-picker';
13import TimePickerLocale from 'rc-time-picker/src/locale/zh_CN';
14
15const showSecond = true;
16const str = showSecond ? 'HH:mm:ss' : 'HH:mm';
17
18const formatter = new DateTimeFormat(str);
19
20const now = new GregorianCalendar(zhCn);
21now.setTime(Date.now());
22
23function onChange(value) {
24 console.log(value && formatter.format(value));
25}
26
27ReactDom.render(
28 <TimePicker formatter={formatter} locale={TimePickerLocale}
29 showSecond={showSecond}
30 defaultValue={now}
31 className="xxx"
32 onChange={onChange}
33 disabledHours={[0, 1, 2, 3, 4, 5, 6, 7, 8, 22, 23]}
34 disabledMinutes={[0, 2, 4, 6, 8]} />,
35 document.getElementById('__react-content')
36);