Sonins commented on a change in pull request #20508:
URL: https://github.com/apache/airflow/pull/20508#discussion_r790619791



##########
File path: airflow/utils/dates.py
##########
@@ -257,7 +257,9 @@ def days_ago(n, hour=0, minute=0, second=0, microsecond=0):
     Get a datetime object representing `n` days ago. By default the time is
     set to midnight.
     """
-    today = timezone.utcnow().replace(hour=hour, minute=minute, second=second, 
microsecond=microsecond)
+    today = datetime.now(timezone.TIMEZONE).replace(
+        hour=hour, minute=minute, second=second, microsecond=microsecond
+    )

Review comment:
       > It’s documented to return the local date  
   
   My wrong, I was confused about this. `date.today()` does returns the system 
local date, but i think we still needs to respect timezone settings in 
airflow.cfg, which is `timezone.TIMEZONE`, not system local date.




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