Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-14 Thread via GitHub


github-actions[bot] commented on PR #66251:
URL: https://github.com/apache/airflow/pull/66251#issuecomment-4453198834

   ### Backport successfully created: v3-2-test
   
   Note: As of [Merging PRs targeted for Airflow 
3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x)
   the committer who merges the PR is responsible for backporting the PRs that 
are bug fixes (generally speaking) to the maintenance branches.
   
   In matter of doubt please ask in 
[#release-management](https://apache-airflow.slack.com/archives/C03G9H97MM2) 
Slack channel.
   
   
   
   Status
   Branch
   Result
   
   
   ✅
   v3-2-test
   https://github.com/apache/airflow/pull/66958";>https://img.shields.io/badge/PR-66958-blue"; alt="PR Link">
   
   


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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-14 Thread via GitHub


bbovenzi merged PR #66251:
URL: https://github.com/apache/airflow/pull/66251


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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-13 Thread via GitHub


junyeong0619 commented on PR #66251:
URL: https://github.com/apache/airflow/pull/66251#issuecomment-4446245852

   Oh, I missed the static check. Pushed after static check.


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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-13 Thread via GitHub


bbovenzi commented on PR #66251:
URL: https://github.com/apache/airflow/pull/66251#issuecomment-900616

   Thanks. Let's just check the static checks. I don't think we need to cast 
`onChange()`


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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-13 Thread via GitHub


junyeong0619 commented on PR #66251:
URL: https://github.com/apache/airflow/pull/66251#issuecomment-423969

   Thanks for the review @bbovenzi . 
   Done — pulled parsing into a single `parseInput()`, and `onPaste` now does 
one `setDisplayDate` + one `emit()` (no longer goes through `onDateChange`).


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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-13 Thread via GitHub


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


##
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##
@@ -54,16 +54,43 @@ export const DateTimeInput = forwardRef(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+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 -MM-DDTHH:mm format in the selected
+// Airflow UI timezone (not the browser's local timezone).
+const localFormat = parsed.tz(selectedTimezone).format("-MM-DDTHH:mm");
+
+// Drop any debounced call queued by prior typing so it cannot fire after
+// this paste and trigger a redundant onChange on the parent form.
+debouncedOnDateChange.cancel();
+onDateChange({
+  ...event,
+  target: { ...event.currentTarget, value: localFormat },
+});
+// Override the display set by onDateChange (which uses 
DEFAULT_DATETIME_FORMAT)
+// so the datetime-local input keeps the -MM-DDTHH:mm format it 
requires.
+setDisplayDate(localFormat);

Review Comment:
   Done. Split out an `emit()` helper so `onPaste` no longer routes through 
`onDateChange`. `setDisplayDate` is called once now, no more invalid 
intermediate value.



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-13 Thread via GitHub


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


##
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##
@@ -54,16 +54,43 @@ export const DateTimeInput = forwardRef(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+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 -MM-DDTHH:mm format in the selected
+// Airflow UI timezone (not the browser's local timezone).
+const localFormat = parsed.tz(selectedTimezone).format("-MM-DDTHH:mm");
+
+// Drop any debounced call queued by prior typing so it cannot fire after
+// this paste and trigger a redundant onChange on the parent form.
+debouncedOnDateChange.cancel();
+onDateChange({
+  ...event,
+  target: { ...event.currentTarget, value: localFormat },
+});
+// Override the display set by onDateChange (which uses 
DEFAULT_DATETIME_FORMAT)
+// so the datetime-local input keeps the -MM-DDTHH:mm format it 
requires.
+setDisplayDate(localFormat);

Review Comment:
   onPaste reuses onDateChange to emit the normalized UTC value, but that also 
causes displayDate to be set once with DEFAULT_DATETIME_FORMAT and then 
immediately overwritten with the datetime-local format. This seems to rely on 
the second update winning. Could we split the emit logic from the display 
update so paste avoids the invalid intermediate value?



##
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##
@@ -54,16 +54,43 @@ export const DateTimeInput = forwardRef(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+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 -MM-DDTHH:mm format in the selected
+// Airflow UI timezone (not the browser's local timezone).
+const localFormat = parsed.tz(selectedTimezone).format("-MM-DDTHH:mm");
+
+// Drop any debounced call queued by prior typing so it cannot fire after
+// this paste and trigger a redundant onChange on the parent form.
+debouncedOnDateChange.cancel();
+onDateChange({
+  ...event,
+  target: { ...event.currentTarget, value: localFormat },
+});
+// Override the display set by onDateChange (which uses 
DEFAULT_DATETIME_FORMAT)
+// so the datetime-local input keeps the -MM-DDTHH:mm format it 
requires.
+setDisplayDate(localFormat);

Review Comment:
   onPaste reuses onDateChange to emit the normalized UTC value, but that also 
causes displayDate to be set once with DEFAULT_DATETIME_FORMAT and then 
immediately overwritten with the datetime-local format. 
   
   This seems to rely on the second update winning. Could we split the emit 
logic from the display update so paste avoids the invalid intermediate value?



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-13 Thread via GitHub


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


##
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##
@@ -54,16 +54,43 @@ export const DateTimeInput = forwardRef(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+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 -MM-DDTHH:mm format in the selected
+// Airflow UI timezone (not the browser's local timezone).
+const localFormat = parsed.tz(selectedTimezone).format("-MM-DDTHH:mm");
+
+// Drop any debounced call queued by prior typing so it cannot fire after
+// this paste and trigger a redundant onChange on the parent form.
+debouncedOnDateChange.cancel();
+onDateChange({
+  ...event,
+  target: { ...event.currentTarget, value: localFormat },
+});
+// Override the display set by onDateChange (which uses 
DEFAULT_DATETIME_FORMAT)
+// so the datetime-local input keeps the -MM-DDTHH:mm format it 
requires.
+setDisplayDate(localFormat);

Review Comment:
   onPaste seems to reuse onDateChange mainly to emit the normalized UTC value, 
but that also means displayDate is briefly set with DEFAULT_DATETIME_FORMAT 
before being overwritten with the datetime-local value. Would it be cleaner to 
separate the emit logic from the display update, so the paste path only sets 
the input value once?



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-13 Thread via GitHub


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


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

Review Comment:
   Yes, and thanks for adding in the debounce cancel too



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-12 Thread via GitHub


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(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+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 -MM-DDTHH:mm format in the selected
+// Airflow UI timezone (not the browser's local timezone).
+const localFormat = parsed.tz(selectedTimezone).format("-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]



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-12 Thread via GitHub


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


##
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##
@@ -54,16 +54,40 @@ export const DateTimeInput = forwardRef(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+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 -MM-DDTHH:mm format in the selected
+// Airflow UI timezone (not the browser's local timezone).
+const localFormat = parsed.tz(selectedTimezone).format("-MM-DDTHH:mm");
+
+onDateChange({
+  ...event,
+  target: { ...event.currentTarget, value: localFormat },
+});

Review Comment:
   I think a race condition should be considered because `onDateChange` can be 
called both with and without debounce.
   
   scenario: 
   1. The user manually enters a value, which schedules `debouncedOnDateChange`.
   2. The user pastes a date within the debounce delay.
   3. The paste handler calls `onDateChange` immediately.
4. The previously scheduled `debouncedOnDateChange` from step 1 runs 
afterward and calls `onDateChange` with the stale manual input value.
 
   As a result, `onDateChange` may use the manual entered value(1) instead of 
the pasted date(2).



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-12 Thread via GitHub


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


##
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##
@@ -54,16 +54,40 @@ export const DateTimeInput = forwardRef(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+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 -MM-DDTHH:mm format in the selected
+// Airflow UI timezone (not the browser's local timezone).
+const localFormat = parsed.tz(selectedTimezone).format("-MM-DDTHH:mm");
+
+onDateChange({
+  ...event,
+  target: { ...event.currentTarget, value: localFormat },
+});

Review Comment:
   I think a race condition should be considered because `onDateChange` can be 
called both with and without debounce.
   
   scenario: 
   1. The user manually enters a value, which schedules `debouncedOnDateChange`.
   2. The user pastes a date within the debounce delay.
   3. The paste handler calls `onDateChange` immediately.
4. The previously scheduled `debouncedOnDateChange` from step 1 runs 
afterward and calls `onDateChange` with the stale manual input value.
 
   As a result, `onDateChange` may use (1) instead of (2).



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-12 Thread via GitHub


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


##
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##
@@ -54,16 +54,40 @@ export const DateTimeInput = forwardRef(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+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 -MM-DDTHH:mm format in the selected
+// Airflow UI timezone (not the browser's local timezone).
+const localFormat = parsed.tz(selectedTimezone).format("-MM-DDTHH:mm");
+
+onDateChange({
+  ...event,
+  target: { ...event.currentTarget, value: localFormat },
+});

Review Comment:
   I think a race condition should be considered here because `onDateChange` 
can be called both with and without debounce.
   
   scenario: 
   1. The user manually enters a value, which schedules `debouncedOnDateChange`.
   2. The user pastes a date within the debounce delay.
   3. The paste handler calls `onDateChange` immediately.
4. The previously scheduled `debouncedOnDateChange` from step 1 runs 
afterward and calls `onDateChange` with the stale manual input value.
 
   As a result, `onDateChange` may use (1) instead of (2).



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-11 Thread via GitHub


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(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+const pasted = event.clipboardData.getData("text");
+const parsed = dayjs(pasted);
+
+if (parsed.isValid()) {
+  event.preventDefault();
+  // datetime-local input requires -MM-DDTHH:mm format
+  const localFormat = parsed.format("-MM-DDTHH:mm");
+
+  setDisplayDate(localFormat);
+  onDateChange({
+...event,
+target: { ...event.currentTarget, value: localFormat },
+  } as unknown as ChangeEvent);
+}
+  };
+
   return (
  {
-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]



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-11 Thread via GitHub


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


##
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##
@@ -54,16 +54,31 @@ export const DateTimeInput = forwardRef(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+const pasted = event.clipboardData.getData("text");
+const parsed = dayjs(pasted);

Review Comment:
   Good catch — you're right that pasted values with an explicit timezone 
should be normalized to the selected Airflow UI timezone, not the browser's. 
I'll switch to `dayjs.tz(pasted, selectedTimezone)` to match the manual input 
path and add tests covering the `Z` / `+09:00` cases.



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-11 Thread via GitHub


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


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

Review Comment:
   This refactor was based on @bbovenzi's review on the previous attempt 
(#65461):
   
 > onPaste and onChange are both parsing a string. Let's try to pull
 > out the shared logic into one function. Probably by modifying
 > onDateChange since onPaste doesn't need debouncing.
   
   onPaste now calls onDateChange directly (no debounce), and the onChange 
cleanup keeps both paths consistent.



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-11 Thread via GitHub


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


##
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##
@@ -54,16 +54,31 @@ export const DateTimeInput = forwardRef(({ onChange, va
 debounceDelay,
   );
 
+  const onPaste = (event: ClipboardEvent) => {
+const pasted = event.clipboardData.getData("text");
+const parsed = dayjs(pasted);

Review Comment:
   I think there may be one timezone-related detail worth considering here.
   
Since paste is another way of entering a value into the same DateTimeInput, 
it might be better for pasted values to follow the same timezone semantics as 
manual input. The existing manual input path uses dayjs.tz(event.target.value, 
selectedTimezone) before converting the value to UTC, so it seems to be based 
on the selected Airflow UI timezone.
   
 For pasted values with an explicit timezone or offset, such as 
`2026-01-15T10:30:00Z` or `2026-01-15T10:30:00+09:00`, we may want to make sure 
the displayed value is converted according to the selected Airflow UI timezone 
rather than the browser’s local timezone.
   
   A concrete example: 
   if the Airflow UI timezone is set to UTC, but the browser timezone is 
Asia/Seoul, pasting `2026-01-15T10:30:00Z` may display `2026-01-15T19:30`.
   Then onDateChange can interpret that as 19:30 in the selected Airflow UI 
timezone, so the submitted value becomes `2026-01-15T19:30:00Z` instead of the 
original `2026-01-15T10:30:00Z`.
   
   https://github.com/user-attachments/assets/24ee5dd7-a81d-4d30-bb79-05732ea3238b";
 />
   
   --- 
 Could you also add tests around this behavior? It would help clarify the 
expected paste behavior and avoid regressions later.



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-11 Thread via GitHub


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


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

Review Comment:
   These changes seem a bit out of scope for this PR to me. I think it might be 
better to leave them out here. What do you think?



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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-11 Thread via GitHub


parkhojeong commented on PR #66251:
URL: https://github.com/apache/airflow/pull/66251#issuecomment-4419419622

   Thank you for the PR. It is very useful.
   
   I have a couple of small suggestions that might help reviewers understand 
the change more easily:
   - The current video was a little difficult to understand in terms of what it 
was demonstrating. It would be
   helpful if the recording could show more clearly what is being tested, 
so reviewers can more easily understand
   what was done.
   - Since most reviewers are English speakers, it might be better to use 
English in the recording.


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



Re: [PR] Allow pasting full datetime strings into date picker inputs [airflow]

2026-05-10 Thread via GitHub


junyeong0619 commented on PR #66251:
URL: https://github.com/apache/airflow/pull/66251#issuecomment-4414725829

   Hi @bbovenzi, this is a small UI fix for #65356. CI is green and ready for 
review when you have a moment. Thanks!


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