Does Bokeh DatetimePicker has it's own time zone?

83 Views Asked by At

I have created a DatetimePicker object and it seems not to care about the value I pass to it and sets to a constant time zone!

from datetime import timedelta, datetime
import pytz

mt_timezone = pytz.timezone('America/Edmonton')

now = datetime.now(mt_timezone).replace(microsecond=0)
end_picker  = DatetimePicker(value=now, title='End Time')

when I print the now, I see 2024-01-10 10:32:42-07:00 but bokeh plot shows 2024-01-10 03:32!!

P.S. I have also tried not passing the mt_timezone to get rid of that -07:00, but nothing changes in bokeh!

Am I missing something here? I would appreciate any help.

1

There are 1 best solutions below

0
Sina Safarabadi On

I found a workaround. Instead of passing it a datetime object, you can pass a UNIX timestamp but make sure to include the milliseconds. For example, for datetime.datetime(2024, 1, 10, 11, 59, 53), don't pass a UNIX timesatnpt of 1704913193 but rather 1704913193000.

Hope this helps anyone that might face the same issue.