rocket-python icon indicating copy to clipboard operation
rocket-python copied to clipboard

Room history latest argument does not handle timezones

Open makew0rld opened this issue 4 years ago • 0 comments

Bug

When I do get_room_history("someid", latest=datetime.datetime.now()), I get the messages from many hours ago, as if those were the most recent.

I am in the UTC-4 timezone, and using .now() results in me getting the messages from 4 hours ago as if they were the most recent. I am guessing this is because Rocket Chat returns UTC timestamps, but .now() returns a local timestamp. It would be helpful if rocket-python did the conversion.

User Solutions

The easiest solution is to set latest like so: latest=datetime.datetime.utcnow(). If I don't want the current time I can put in other timestamps, but they should still be in UTC.

makew0rld avatar Sep 09 '20 19:09 makew0rld