Taragolis commented on code in PR #34492:
URL: https://github.com/apache/airflow/pull/34492#discussion_r1330818842
##########
airflow/serialization/serializers/datetime.py:
##########
@@ -44,7 +44,7 @@ def serialize(o: object) -> tuple[U, str, int, bool]:
if is_naive(o):
o = convert_to_utc(o)
- tz = o.tzname()
+ tz = o.tzinfo.name # type: ignore
Review Comment:
Dumb solution which should work for different types of tzinfo
```suggestion
from pendulum.tz.timezone import FixedTimezone, Timezone
tzi = o.tzinfo
if isinstance(tzi, FixedTimezone):
tz = tzi.offset or "UTC"
elif isinstance(tzi, Timezone):
tz = tzi.name
else:
tz = int(o.utcoffset().total_seconds()) or "UTC"
```
--
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]