uranusjr commented on a change in pull request #20508:
URL: https://github.com/apache/airflow/pull/20508#discussion_r782649432
##########
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:
> date.today() returns today in UTC.
It’s documented to return the local date, so if it really returns the UTC
time’s date as you describe, there’s a serious bug in Python. But all those
ultimately depend on `time.time()` anyway, so let’s use your version since you
already made sure it works 🙂
--
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]