You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2025/05/06 13:25:27 UTC
(airflow) 16/25: Fix datetime validation (#50116)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit ca8d0114cd15506ac801380a233530a2f8de005c
Author: Guan Ming(Wesley) Chiu <10...@users.noreply.github.com>
AuthorDate: Fri May 2 19:38:31 2025 +0800
Fix datetime validation (#50116)
(cherry picked from commit 205a672f75159ad1dc10430fde95e28e0b420b23)
---
.../src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx | 3 +--
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx | 4 +++-
.../src/airflow/ui/src/components/FlexibleForm/FlexibleForm.tsx | 3 ---
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx b/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx
index 668f54a3d4c..3cf45688eed 100644
--- a/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx
+++ b/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx
@@ -156,7 +156,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
<Text fontSize="md" fontWeight="semibold" mb={3}>
Date Range
</Text>
- <HStack w="full">
+ <HStack alignItems="flex-start" w="full">
<Controller
control={control}
name="from_date"
@@ -175,7 +175,6 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
<Field.Root invalid={Boolean(errors.date) || dataIntervalInvalid} required>
<Field.Label>To</Field.Label>
<DateTimeInput {...field} max={today} onBlur={resetDateError} size="sm" />
- <Field.ErrorText> </Field.ErrorText>
</Field.Root>
)}
/>
diff --git a/airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx b/airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx
index c4fa9010fc2..48c7a41099e 100644
--- a/airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx
+++ b/airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx
@@ -43,7 +43,9 @@ export const DateTimeInput = forwardRef<HTMLInputElement, Props>(({ onChange, va
target: {
...event.target,
// Return a timezone-aware ISO string
- value: dayjs(event.target.value).tz(selectedTimezone, true).toISOString(),
+ value: dayjs(event.target.value).isValid()
+ ? dayjs(event.target.value).tz(selectedTimezone, true).toISOString()
+ : "",
},
})
}
diff --git a/airflow-core/src/airflow/ui/src/components/FlexibleForm/FlexibleForm.tsx b/airflow-core/src/airflow/ui/src/components/FlexibleForm/FlexibleForm.tsx
index ae9e60c812f..6f5562747fe 100644
--- a/airflow-core/src/airflow/ui/src/components/FlexibleForm/FlexibleForm.tsx
+++ b/airflow-core/src/airflow/ui/src/components/FlexibleForm/FlexibleForm.tsx
@@ -53,7 +53,6 @@ export const FlexibleForm = ({
setSectionError(sectionError);
}
});
- console.log("errors1", sectionError);
}, [flexibleFormDefaultSection, params, sectionError]);
useEffect(() => {
@@ -91,8 +90,6 @@ export const FlexibleForm = ({
}
};
- console.log(sectionError);
-
return Object.entries(params).some(([, param]) => typeof param.schema.section !== "string")
? Object.entries(params).map(([, secParam]) => {
const currentSection = secParam.schema.section ?? flexibleFormDefaultSection;