修改bug

This commit is contained in:
筱野
2025-09-13 10:55:06 +08:00
parent aef84e76cb
commit 52bee95505
9 changed files with 317 additions and 349 deletions

View File

@@ -30,13 +30,12 @@ const TimeSelector: React.FC<TimeSelectorProps> = ({
const handleConfirm = (date: Date) => {
console.log('选择的日期:', date)
const start_time = currentTimeType === 'start' ? getDateStr(date) : value.start_time;
const isLater = dayjs(value.start_time).isAfter(dayjs(value.end_time));
const end_time = currentTimeType === 'end' ? getDateStr(date) : value.end_time;
const isLater = dayjs(start_time).isAfter(dayjs(end_time));
if (isLater) {
if (onChange) onChange({start_time, end_time: getEndTime(start_time)})
return
}
const initEndTime = value.end_time ? value.end_time : getEndTime(start_time)
const end_time = currentTimeType === 'end' ? getDateStr(date) : initEndTime;
if (onChange) onChange({start_time, end_time})
}
const openPicker = (type: 'start' | 'end') => {
@@ -87,12 +86,14 @@ const TimeSelector: React.FC<TimeSelectorProps> = ({
</View>
</View>
</View>
<DialogCalendarCard
{
visible && <DialogCalendarCard
visible={visible}
value={currentTimeValue}
onChange={handleConfirm}
onClose={() => setVisible(false)}
/>
}
</View>
)
}