The advantage of this is that it handles users that are in transit or on a short trip, and intentionally don't want to use the current timezone. A better usability would be to display a message saying "we detected that your timezone is XXX, click here to update the app to this timezone", and only set the session variable if the user clicks that link. If you need to re-render some content, you can end the button's logic with a redirect, which will reload the screen. skip the click on the button if the session variable was already initialized with an offset).Ī consequence of this is that you cannot be sure of the client's timezone on the first page load. I also suggest you only do this once (e.g. You can do this by including a hidden input and a button on your layout web block, then on page load use a javascript to write the timezone offset into that input and automatically click the button. What I suggest you to do is to use this JavaScript API to send the offset to the server, and store it on a session variable. Here is the API you should use for that effect: Your resource to discover and connect with designers worldwide. You need to resort to JavaScript to find out the client's timezone. Discover 1 Time Zone Icon design on Dribbble. ahead of UTC (Coordinated Universal Time). Heck, it isn't even available through HTTP (as opposed to the language, which is available in HTTP headers). UTC (Coordinated Universal Time) is one of the well-known names of UTC+0 time zone which is 0h. Unfortunately the client timezone is not available through this component.
0 Comments
Leave a Reply. |