Skip to content

Commit

Permalink
Merge pull request #953 from oceanbase/linhf/fix-dateranger-time
Browse files Browse the repository at this point in the history
improve(DateRanger): Should start time is before the end time.
  • Loading branch information
dengfuping authored Jan 22, 2025
2 parents 5e1a4be + 5cd2083 commit 35fcd00
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/ui/src/DateRanger/PickerPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,16 @@ const InternalPickerPanel = (props: PickerPanelProps) => {
onClick={() => {
form.validateFields().then(values => {
const { startDate, startTime, endDate, endTime } = values;
const start = `${startDate} ${startTime.format(TIME_FORMAT)}`;
const end = `${endDate} ${endTime.format(TIME_FORMAT)}`;
// 日期同一天时对时间进行排序,保证开始时间在结束时间之前
const [sTime, eTime] =
startDate === endDate
? [startTime, endTime].sort((a, b) => {
return a?.valueOf() - b?.valueOf();
})
: [startTime, endTime];

const start = `${startDate} ${sTime.format(TIME_FORMAT)}`;
const end = `${endDate} ${eTime.format(TIME_FORMAT)}`;

let errorList = [];
let message = '';
Expand Down

0 comments on commit 35fcd00

Please sign in to comment.