You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Taragolis (via GitHub)" <gi...@apache.org> on 2023/02/19 10:06:49 UTC

[GitHub] [airflow] Taragolis commented on a diff in pull request #29606: convert moment with timezone to UTC instead of raising an exception

Taragolis commented on code in PR #29606:
URL: https://github.com/apache/airflow/pull/29606#discussion_r1111206098


##########
airflow/triggers/temporal.py:
##########
@@ -41,10 +41,8 @@ def __init__(self, moment: datetime.datetime):
         # Make sure it's in UTC
         elif moment.tzinfo is None:
             raise ValueError("You cannot pass naive datetimes")
-        elif not hasattr(moment.tzinfo, "offset") or moment.tzinfo.offset != 0:  # type: ignore
-            raise ValueError(f"The passed datetime must be using Pendulum's UTC, not {moment.tzinfo!r}")
         else:
-            self.moment = moment
+            self.moment = timezone.convert_to_utc(moment)

Review Comment:
   "Tests Police" here 🤣 , we need also test this one.
   
   A guess we do not have unittests for this constructor except type checking.
   The same valid for `TimeDeltaTrigger` which based on `DateTimeTrigger`



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