I’m trying to add the user’s timezone whenever they visit the app for a calendar of events I’m building in liveview. I can get the the timezone just fine in the browser but am stuck with how to add it to the session. Is this just an ajax post to a route which updates the session?
As a consumer I really dislike apps that assume anything about my preferences based upon browser environment. I would always prefer there is a preference for me to set, with perhaps the default being the browsers timezone.
That aside, yes, you would need to send a request via a Phoenix channel, an Ajax call or possibly a live view hook in order for it to be added to the session if you intend to keep track of it.
Thanks for the feedback! I like the hook suggestion.