]>
git.immae.eu Git - github/fretlink/time-picker.git/blob - examples/disabled.js
a38ce160611df57c35098b357dfcac13443ea7c8
1 /* eslint no-console:0 */
3 import 'rc-time-picker/assets/index.less';
5 import React
from 'react';
6 import ReactDom
from 'react-dom';
8 import moment
from 'moment';
10 import TimePicker
from 'rc-time-picker';
12 const showSecond
= true;
13 const str
= showSecond
? 'HH:mm:ss' : 'HH:mm';
15 const now
= moment().hour(14).minute(30);
17 function generateOptions(length
, excludedOptions
) {
19 for (let value
= 0; value
< length
; value
++) {
20 if (excludedOptions
.indexOf(value
) < 0) {
27 function onChange(value
) {
28 console
.log(value
&& value
.format(str
));
31 function disabledHours() {
32 return [0, 1, 2, 3, 4, 5, 6, 7, 8, 22, 23];
35 function disabledMinutes(h
) {
38 return generateOptions(60, [30]);
40 return generateOptions(60, [0]);
42 return generateOptions(60, [0, 30]);
46 function disabledSeconds(h
, m
) {
52 <h3
>Disabled picker
</h3
>
58 <h3
>Disabled options
</h3
>
60 showSecond
={showSecond
}
64 disabledHours
={disabledHours
}
65 disabledMinutes
={disabledMinutes
}
66 disabledSeconds
={disabledSeconds
}
69 , document
.getElementById('__react-content'));