Determine user's local timezone

Hi,

I have a set of UTC timestamps that I would like to present to users in their browsers’ respective timezones (not deployment server’s timezone). Is there a way to go about this which doesn’t involve geolocating their IP addresses?

Thanks in advance!

1 Like

I guess How can I get the IP of an incoming request? is a similar type of question - how can we get information of the user querying our app?

+1 that browser/user timezone access should be a built in feature to streamlit, especially when streamlit cloud may be running in a non-local timezone.

It’s easy enough using streamlit-javascript · PyPI though:

timezone = st_javascript("""await (async () => {
            const userTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
            console.log(userTimezone)
            return userTimezone
})().then(returnValue => returnValue)""")

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.