GetStream / react-activity-feed

Stream React Activity Feed Components
https://getstream.io/react-activity-feed/
BSD 3-Clause "New" or "Revised" License
137 stars 83 forks source link

Handle string timestamps with timezone in format ±hh:mm #314

Closed danypype closed 2 years ago

danypype commented 2 years ago

Updated the humanizeTimestamp function to properly handle string timestamps with the timezone in format ±hh:mm which is also ISO 8601-compliant

Reason for the change:

The python SDK returns activity.time as a datetime.datetime object in feed.get, when these objects are sent as part of a JSON API payload they get converted to an ISO string with timezone in format ±hh:mm

>>> datetime.datetime(2021, 12, 6, 22, 35, 43, 345000, tzinfo=pytz.UTC).isoformat()
'2021-12-06T22:35:43.345000+00:00'
arnautov-anton commented 2 years ago

Hey, @danypype! Thank you for your contribution, this seems like a very reasonable feature to add so it's a :heavy_check_mark: from me. :+1:

danypype commented 2 years ago

😄