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


##########
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##########
@@ -54,16 +54,40 @@ export const DateTimeInput = forwardRef<HTMLInputElement, 
Props>(({ onChange, va
     debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent<HTMLInputElement>) => {
+    const pasted = event.clipboardData.getData("text").trim();
+    // Pasted strings with an explicit timezone (e.g. `Z` or `+09:00`) are 
parsed
+    // as their absolute instant. Strings without one are treated as being in 
the
+    // selected Airflow UI timezone — consistent with manual input.
+    const hasExplicitTz = /(?:[Zz]|[+-]\d{2}:?\d{2})$/u.test(pasted);
+    const parsed = hasExplicitTz ? dayjs(pasted) : dayjs.tz(pasted, 
selectedTimezone);
+
+    if (!parsed.isValid()) {
+      return;
+    }
+
+    event.preventDefault();
+    // datetime-local input requires YYYY-MM-DDTHH:mm format in the selected
+    // Airflow UI timezone (not the browser's local timezone).
+    const localFormat = parsed.tz(selectedTimezone).format("YYYY-MM-DDTHH:mm");
+
+    onDateChange({
+      ...event,
+      target: { ...event.currentTarget, value: localFormat },
+    });

Review Comment:
   Thanks for review! Fixed by canceling any pending debounced call at the 
start of onPaste. Added a test that reproduces the double-fire without the 
cancel.



-- 
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