You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "taltal-beep (via GitHub)" <gi...@apache.org> on 2026/10/16 04:39:02 UTC

[PR] Use the Dag timezone's date for BranchDateTimeOperator time targets [airflow]

taltal-beep opened a new pull request, #74838:
URL: https://github.com/apache/airflow/pull/74838

   When `target_lower` / `target_upper` are `datetime.time` values, `BranchDateTimeOperator` combines them with the current **UTC** date and then localizes the result to the Dag's timezone. For a Dag east of UTC, early in the local morning the UTC date is still the previous day, so the window is built for yesterday and the false branch is taken.
   
   Example: Dag in `Asia/Seoul`, window 07:00–23:00, now 07:50 Seoul (22:50 UTC the day before). The window becomes 07:00–23:00 Seoul *yesterday*, so now is past the upper bound and the operator follows `follow_task_ids_if_false`.
   
   This combines the times with the current date in the Dag's timezone instead. UTC Dags and `datetime` targets are unaffected.
   
   Added a test with a Seoul Dag: the in-window case fails on `main` and passes with the change; two out-of-window cases make sure the window is not just shifted.
   
   related: #40151 (closed as stale; the follow-up comment there tested `datetime` bounds, which are not affected)
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use the Dag timezone's date for BranchDateTimeOperator time targets [airflow]

Posted by "yuseok89 (via GitHub)" <gi...@apache.org>.
yuseok89 commented on code in PR #74838:
URL: https://github.com/apache/airflow/pull/74838#discussion_r4326019816


##########
providers/standard/src/airflow/providers/standard/operators/datetime.py:
##########


Review Comment:
   It looks like this also covers the `use_task_logical_date=True` path, which #40151 mentions too. Would it be worth adding a test case for that path as well?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use the Dag timezone's date for BranchDateTimeOperator time targets [airflow]

Posted by "taltal-beep (via GitHub)" <gi...@apache.org>.
taltal-beep commented on code in PR #74838:
URL: https://github.com/apache/airflow/pull/74838#discussion_r4326921165


##########
providers/standard/src/airflow/providers/standard/operators/datetime.py:
##########


Review Comment:
   Good point, thanks. Added the same three cases for `use_task_logical_date=True` in the latest commit; the date-boundary one fails without the fix.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use the Dag timezone's date for BranchDateTimeOperator time targets [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #74838:
URL: https://github.com/apache/airflow/pull/74838#issuecomment-6208207874

   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our [Contributors' Guide](https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (ruff, mypy and type annotations). Our [prek-hooks]( https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst#prerequisites-for-prek-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/airflow-core/docs/howto/custom-operator.rst) Consider adding an example Dag that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/dev/breeze/doc/README.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#coding-style-and-best-practices).
   - Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org