uranusjr commented on code in PR #51043:
URL: https://github.com/apache/airflow/pull/51043#discussion_r2106153642


##########
providers/standard/src/airflow/providers/standard/sensors/time.py:
##########
@@ -88,8 +90,10 @@ def __init__(
 
         # Create a "date-aware" timestamp that will be used as the 
"target_datetime". This is a requirement
         # of the DateTimeTrigger
+
+        # Get date considering dag.timezone
         aware_time = timezone.coerce_datetime(
-            datetime.datetime.combine(datetime.datetime.today(), target_time, 
self.dag.timezone)
+            datetime.datetime.combine(pendulum.now(tz=str(self.dag.timezone)), 
target_time, self.dag.timezone)

Review Comment:
   This can simply be `datetime.datetime.now(self.dag.timezone)` without 
involving pendulum, nor calling `str()`.
   
   Note in particular that casting a timezone to str does not always work as 
you expect.



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