junyeong0619 commented on code in PR #66251:
URL: https://github.com/apache/airflow/pull/66251#discussion_r3220019488


##########
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##########
@@ -54,16 +54,31 @@ export const DateTimeInput = forwardRef<HTMLInputElement, 
Props>(({ onChange, va
     debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent<HTMLInputElement>) => {
+    const pasted = event.clipboardData.getData("text");
+    const parsed = dayjs(pasted);
+
+    if (parsed.isValid()) {
+      event.preventDefault();
+      // datetime-local input requires YYYY-MM-DDTHH:mm format
+      const localFormat = parsed.format("YYYY-MM-DDTHH:mm");
+
+      setDisplayDate(localFormat);
+      onDateChange({
+        ...event,
+        target: { ...event.currentTarget, value: localFormat },
+      } as unknown as ChangeEvent<HTMLInputElement>);
+    }
+  };
+
   return (
     <Input
       data-testid="datetime-input"
       onChange={(event) => {
-        const local = dayjs(event.target.value).isValid() ? event.target.value 
: "";
-
-        setDisplayDate(local);
-        // Parse input to UTC once user finishes typing

Review Comment:
   Adding a bit more context—I completely understand why it might look out of 
scope at first glance! However, to avoid duplicating the parsing logic for 
paste events, bringing this into onDateChange was necessary.
   
   I am currently preparing a minor update to ensure onPaste explicitly passes 
through onDateChange while keeping the correct local display format for the 
input. I will push the commit when it ready.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to