Skip to content

Commit

Permalink
Revert "fix(date-range-quick-picker): support the time disabled of pr…
Browse files Browse the repository at this point in the history
…ops (min…"

This reverts commit ce2a2e1.
  • Loading branch information
landluck authored Dec 16, 2024
1 parent 8e25ae6 commit c648994
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 120 deletions.
21 changes: 2 additions & 19 deletions packages/zent/__tests__/date-range-quick-picker.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,47 +36,30 @@ describe('DateRangeQuickPicker', () => {
value={[1524106071377, 1524107071377]}
onChange={onChange}
valueType="number"
format="YYYY-MM-DD HH:mm:ss"
min="2020-04-19 10:05:12"
max="2025-01-01 12:05:12"
/>
);

wrapper.instance().handleChosenDays(1);
expect(onChange.mock.calls.length).toBe(1);
wrapper.find('.zent-datepicker-trigger').at(1).simulate('click');
});

it('suppports default preset', () => {
const onChange = jest.fn();
const wrapper = mount(
mount(
<DateRangeQuickPicker
value={[1524106071377, 1524107071377]}
onChange={onChange}
defaultSelectedPresetIndex={0}
disabledDate={{
min: '2018-04-19 10:05:12',
max: '2018-04-19 15:05:12',
}}
/>
);
expect(onChange.mock.calls.length).toBe(0);
wrapper.find('.zent-datepicker-trigger').at(0).simulate('click');

const wrapper2 = mount(
mount(
<DateRangeQuickPicker
onChange={onChange}
defaultSelectedPresetIndex={0}
disabledTime={() => {
return {
disabledHours: () => [],
disabledMinutes: () => [],
disabledSeconds: () => [],
};
}}
/>
);
expect(onChange.mock.calls.length).toBe(1);
wrapper2.find('.zent-datepicker-trigger').at(1).simulate('click');
});
});
9 changes: 1 addition & 8 deletions packages/zent/src/date-picker/components/RangePickerBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import useRangeMergedProps from '../hooks/useRangeMergedProps';
import useRangeDisabledDate from '../hooks/useRangeDisabledDate';
import { useShowTimeRangeOption } from '../hooks/useShowTimeOption';
import useNormalizeDisabledDate from '../hooks/useNormalizeDisabledDate';
import useNormalizeDisabledTime from '../hooks/useNormalizeDisabledTime';
import { useEventCallbackRef } from '../../utils/hooks/useEventCallbackRef';

import {
Expand Down Expand Up @@ -47,7 +46,7 @@ const RangePicker: React.FC<IRangePickerProps> = ({
onChange,
onClose,
onOpen,
disabledTime: disabledTimeProps,
disabledTime,
generateDate,
PickerComponent,
showTime,
Expand Down Expand Up @@ -105,12 +104,6 @@ const RangePicker: React.FC<IRangePickerProps> = ({
[start, end, showTime, onChangeRef, getCallbackRangeValue, setSelected]
);

const disabledTime = useNormalizeDisabledTime(
format,
disabledDateProps,
disabledTimeProps
);

const { disabledStartTimes, disabledEndTimes } = useRangeDisabledTime({
selected,
disabledTime,
Expand Down
16 changes: 0 additions & 16 deletions packages/zent/src/date-picker/hooks/useNormalizeDisabledTime.ts

This file was deleted.

This file was deleted.

0 comments on commit c648994

Please sign in to comment.