Skip to content

Commit ca8d011

Browse files
guan404mingkaxil
authored andcommitted
Fix datetime validation (#50116)
(cherry picked from commit 205a672)
1 parent a7e74d3 commit ca8d011

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
156156
<Text fontSize="md" fontWeight="semibold" mb={3}>
157157
Date Range
158158
</Text>
159-
<HStack w="full">
159+
<HStack alignItems="flex-start" w="full">
160160
<Controller
161161
control={control}
162162
name="from_date"
@@ -175,7 +175,6 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
175175
<Field.Root invalid={Boolean(errors.date) || dataIntervalInvalid} required>
176176
<Field.Label>To</Field.Label>
177177
<DateTimeInput {...field} max={today} onBlur={resetDateError} size="sm" />
178-
<Field.ErrorText>&nbsp;</Field.ErrorText>
179178
</Field.Root>
180179
)}
181180
/>

airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ export const DateTimeInput = forwardRef<HTMLInputElement, Props>(({ onChange, va
4343
target: {
4444
...event.target,
4545
// Return a timezone-aware ISO string
46-
value: dayjs(event.target.value).tz(selectedTimezone, true).toISOString(),
46+
value: dayjs(event.target.value).isValid()
47+
? dayjs(event.target.value).tz(selectedTimezone, true).toISOString()
48+
: "",
4749
},
4850
})
4951
}

airflow-core/src/airflow/ui/src/components/FlexibleForm/FlexibleForm.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export const FlexibleForm = ({
5353
setSectionError(sectionError);
5454
}
5555
});
56-
console.log("errors1", sectionError);
5756
}, [flexibleFormDefaultSection, params, sectionError]);
5857

5958
useEffect(() => {
@@ -91,8 +90,6 @@ export const FlexibleForm = ({
9190
}
9291
};
9392

94-
console.log(sectionError);
95-
9693
return Object.entries(params).some(([, param]) => typeof param.schema.section !== "string")
9794
? Object.entries(params).map(([, secParam]) => {
9895
const currentSection = secParam.schema.section ?? flexibleFormDefaultSection;

0 commit comments

Comments
 (0)