dstandish commented on a change in pull request #5332: [AIRFLOW-3391] Upgrade 
pendulum to latest major version.
URL: https://github.com/apache/airflow/pull/5332#discussion_r294097557
 
 

 ##########
 File path: airflow/utils/timezone.py
 ##########
 @@ -89,10 +89,11 @@ def convert_to_utc(value):
     if not value:
         return value
 
-    if not is_localized(value):
-        value = pendulum.instance(value, TIMEZONE)
-
-    return value.astimezone(utc)
+    return (
 
 Review comment:
   The issue causing failing `test_following_previous_schedule` with this 
change.  
   The problem is that `pendulum.instance(start)` does not convert correctly.
   
   This seems to work:
   ```suggestion
       if isinstance(value, pendulum.DateTime):
           return value.astimezone(utc)
       elif not is_localized(value):
           return pendulum.instance(value, TIMEZONE)
       else:
           return utc.convert(value)
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to