Thanks for your contribution, Jambu.
I'd appreciate a link to your repository, though.
Because coding "something similar" is a bit too vague for most of us, I guess. 😵
I made these changes to the source files so that the timezone is automatically set by the user's local timezone. I checked out the repo from github to branch and commit these, but it didn't have any of these files... Well this is not letting me put all the changes I made. But something like this:
I did something similar to this:
const local_timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; var select = $('.timezone-dropdown'); var option = select.find("option:contains("+ local_timezone +")"); var optionTop = option.offset().top var selectTop = select.offset().top; select.scrollTop(select.scrollTop() + (optionTop - selectTop)); option.prop('selected', true);
(just to be clear, this was about time ZONES, not the exact city a user may be located in. Z-Man's response is correct that it's not easy to determine that. If you prefer the UTC offset of your time ZONE rather than the city usually associated with that timezone as my example displays, that's easy enough to find also, just read the stackoverflow post I linked)
(in reference to my last post)
since Goodwin specifically asked why users should have to go through the stress of locating their correct time zone, you could do something like the following:
easy peasy. alternatively you can give the user option to update their current timezone in their profile settings. I really don't see what's so difficult about this.
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone; console.log(tz);
obviously its not going to be possible with a server side lang like php because timezone is set on the client side.
Hope that helps, Estee and Goodwin.
It's not possible to find out your exact location without using a 3rd party database. And all these service providers would allow only a limited number of requests per day/per month/etc. - otherwise they'll want you to pay.
Timezone 1.2 comes with a different solution which isn't that precise, but will lead you to the first city which is located in your own timezone.
Dear Sir, ~Z~ Man,
thank you for politeness and nice explaining. :)
Blessing to you!
I love Ossn very much, and this little unpleasant moment cannot change my good mind about your team as high and great professionals.
Respectfully and with friendly love,