uranusjr commented on a change in pull request #20508:
URL: https://github.com/apache/airflow/pull/20508#discussion_r780969367
##########
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:
Or even
```python
def days_ago(n, hour=0, minute=0, second=0, microsecond=0):
return datetime.combine(
date.today() - timedelta(days=n),
time(hour, minute, second, microsecond, tzinfo=timezone.TIMEZONE),
)
```
--
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]