I would like to know if there is a way to automatically retrieve user’s timezone from client. Especially during login.
I tried to add this in the login page (using auth.login):
{% get_current_timezone as TIME_ZONE %}
Then, add this in the login form:
<input type="hidden" name="next" value="/redirect/?tz={{ TIME_ZONE }}">
But, tz is always the timezone of the server.
From the documentation:
You can try setting timezone cookie via javascript by utilizing getTimezoneOffset function or try to do some geoip magic and figure timezone by location. Probably the most reliable way would be to ask the user directly and save this information in user profile/session.