I would like to know the local timezone a user is in. E.g. knowing that LA is 7 hours behind UTC can I get the time difference of a user from the browser, to test whether the user is in the local (LA) timezone?
I would like to have the following statement on my website
{% if user.timedelta_to_utc == -7 %}
is there a way to get user.timedelta_to_utc? thanks carl
edit: Ok here is my attempt, which failed. I used the moments.js package and did the following
{% if moment(utc_time).calendar() != moment(local_time, local=True).calendar() %}
where utc_time is a timestamp at utc time and local_time is the same timestamp corrected by the time difference between local and utc. So the statement above should be true if I am in a different timezone (The moments package automatically transfers the date to local time except if I give it local=True). It seems that moment objects cannot be compared that way, since the statement above seems to be always true...