You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/19 06:35:52 UTC

[GitHub] [airflow] Soonmok commented on a diff in pull request #28400: Rewrite timezone assign codeline

Soonmok commented on code in PR #28400:
URL: https://github.com/apache/airflow/pull/28400#discussion_r1051854266


##########
airflow/models/dag.py:
##########
@@ -462,8 +462,10 @@ def __init__(
         # set timezone from start_date
         tz = None
         if start_date and start_date.tzinfo:
-            tzinfo = None if start_date.tzinfo else settings.TIMEZONE
-            tz = pendulum.instance(start_date, tz=tzinfo).timezone
+            if start_date.tzinfo is None:
+                tz = pendulum.instance(start_date, tz=settings.TIMEZONE).timezone
+            else:
+                tz = pendulum.instance(start_date).timezone

Review Comment:
   ah, right. I made a mistake. 
   Should be 
   ```
   if start_date:
       tzinfo = None if start_date.tzinfo else settings.TIMEZONE
       tz = pendulum.instance(start_date, tz=tzinfo).timezone
       if start_date.tzinfo is None:
           tz = pendulum.instance(start_date, tz=settings.TIMEZONE).timezone
       else:
           tz = pendulum.instance(start_date).timezone
   ```
   but I think we don't need to proceed with this change. 
   I will look another issues up.



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