Skip to content

Commit a71aed3

Browse files
committed
chore: merge code
1 parent 2e5ccb5 commit a71aed3

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

src/NewPicker/PickerInput/SinglePicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ function Picker<DateType extends object = any>(
185185

186186
// ======================== Values ========================
187187
const [mergedValue, setInnerValue, getCalendarValue, triggerCalendarChange] = useInnerValue(
188+
multiple,
188189
generateConfig,
189190
locale,
190-
multiple,
191191
formatList,
192192
defaultValue,
193193
value,

src/NewPicker/PickerInput/hooks/useRangeValue.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,22 +174,7 @@ export default function useRangeValue<DateType extends object = any>(
174174
const orderOnChange = disabled.some((d) => d) ? false : order;
175175

176176
// ============================= Util =============================
177-
const getDateTexts = ([start, end]: RangeValueType<DateType>) => {
178-
return [start, end].map((date) =>
179-
formatValue(date, { generateConfig, locale, format: formatList[0] }),
180-
) as [string, string];
181-
};
182-
183-
const isSameDates = (source: RangeValueType<DateType>, target: RangeValueType<DateType>) => {
184-
const [prevStart = null, prevEnd = null] = source;
185-
const [nextStart = null, nextEnd = null] = target;
186-
187-
const isSameStart =
188-
prevStart === nextStart || isSameTimestamp(generateConfig, prevStart, nextStart);
189-
const isSameEnd = prevEnd === nextEnd || isSameTimestamp(generateConfig, prevEnd, nextEnd);
190-
191-
return [isSameStart && isSameEnd, isSameStart, isSameEnd];
192-
};
177+
const [getDateTexts, isSameDates] = useUtil(generateConfig, locale, formatList);
193178

194179
// ============================ Values ============================
195180
// Used for trigger `onChange` event.

0 commit comments

Comments
 (0)