|
|
|
@ -25,7 +25,6 @@ function range(start, end) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function disabledDate(current) {
|
|
|
|
|
// can not select days before today and today
|
|
|
|
|
return current && current.valueOf() < Date.now();
|
|
|
|
@ -33,51 +32,32 @@ function disabledDate(current) {
|
|
|
|
|
|
|
|
|
|
function disabledDateTime() {
|
|
|
|
|
return {
|
|
|
|
|
disabledHours() {
|
|
|
|
|
return range(0, 60).splice(4, 20);
|
|
|
|
|
},
|
|
|
|
|
disabledMinutes() {
|
|
|
|
|
return range(30, 60);
|
|
|
|
|
},
|
|
|
|
|
disabledSeconds() {
|
|
|
|
|
return [55, 56];
|
|
|
|
|
},
|
|
|
|
|
disabledHours: () => range(0, 60).splice(4, 20),
|
|
|
|
|
disabledMinutes: () => range(30, 60),
|
|
|
|
|
disabledSeconds: () => [55, 56],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function disabledRangeTime(_, type) {
|
|
|
|
|
if (type === 'start') {
|
|
|
|
|
return {
|
|
|
|
|
disabledHours() {
|
|
|
|
|
return range(0, 60).splice(4, 20);
|
|
|
|
|
},
|
|
|
|
|
disabledMinutes() {
|
|
|
|
|
return range(30, 60);
|
|
|
|
|
},
|
|
|
|
|
disabledSeconds() {
|
|
|
|
|
return [55, 56];
|
|
|
|
|
},
|
|
|
|
|
disabledHours: () => range(0, 60).splice(4, 20),
|
|
|
|
|
disabledMinutes: () => range(30, 60),
|
|
|
|
|
disabledSeconds: () => [55, 56],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
disabledHours() {
|
|
|
|
|
return range(0, 60).splice(20, 4);
|
|
|
|
|
},
|
|
|
|
|
disabledMinutes() {
|
|
|
|
|
return range(0, 31);
|
|
|
|
|
},
|
|
|
|
|
disabledSeconds() {
|
|
|
|
|
return [55, 56];
|
|
|
|
|
},
|
|
|
|
|
disabledHours: () => range(0, 60).splice(20, 4),
|
|
|
|
|
disabledMinutes: () => range(0, 31),
|
|
|
|
|
disabledSeconds: () => [55, 56],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
|
<div>
|
|
|
|
|
<DatePicker disabledDate={disabledDate} disabledTime={disabledDateTime} showTime />
|
|
|
|
|
<DatePicker format="YYYY-MM-DD HH:mm:ss" disabledDate={disabledDate} disabledTime={disabledDateTime} showTime />
|
|
|
|
|
<br />
|
|
|
|
|
<RangePicker disabledDate={disabledDate} disabledTime={disabledRangeTime} showTime />
|
|
|
|
|
</div>,
|
|
|
|
|
mountNode
|
|
|
|
|
);
|
|
|
|
|
<RangePicker format="YYYY-MM-DD HH:mm:ss" disabledDate={disabledDate} disabledTime={disabledRangeTime} showTime />
|
|
|
|
|
</div>
|
|
|
|
|
, mountNode);
|
|
|
|
|
````
|
|
|
|
|