Skip to content

Commit 476777e

Browse files
committed
Add a comment explaning the logic
1 parent 1e3bd30 commit 476777e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

firebase_admin/_messaging_encoder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ def encode_android_notification(cls, notification):
324324

325325
event_time = result.get('event_time')
326326
if event_time:
327+
# if the datetime instance is not naive (tzinfo is present), convert to UTC
328+
# otherwise (tzinfo is None) assume the datetime instance is already in UTC
327329
if event_time.tzinfo is not None:
328330
event_time = event_time.astimezone(datetime.timezone.utc)
329331
result['event_time'] = event_time.strftime('%Y-%m-%dT%H:%M:%S.%fZ')

0 commit comments

Comments
 (0)