Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get timezone from browser #169

Closed
dreeves opened this issue Apr 3, 2018 · 2 comments
Closed

Get timezone from browser #169

dreeves opened this issue Apr 3, 2018 · 2 comments
Labels
ADO Consensus needed on what to Actually Do (or "much ado about ∅"), AKA question RFE Request For Enhancement AKA feature request UVI User-Visible Improvement zzz (closed as) postponed
Projects

Comments

@dreeves
Copy link
Contributor

dreeves commented Apr 3, 2018

For modern browsers there’s something built in to Javascript that should work:

Intl.DateTimeFormat().resolvedOptions().timeZone

That correctly returns America/Los_Angeles for me in Chrome and looks pretty safe to use in general: https://caniuse.com/#search=Intl

I gather there's a concern from @chrisbutler and @pjjh that geoIP/IPAPI may better handle the use case of someone traveling. I believe, contrariwise, that the above javascript is always the right thing to use. If you haven’t changed the timezone for your computer then we should treat that as intentional and not try to be clever and figure out where you really are by your IP address.

@dreeves dreeves added the RFE Request For Enhancement AKA feature request label Apr 3, 2018
@dreeves
Copy link
Contributor Author

dreeves commented Apr 6, 2018

Correction from @chrisbutler: It's not traveling but rather @pjjh's use case of creating promises via Curl. In my opinion that could make geoIP worthwhile as a fallback. But really if you're going to create a promise programmatically with Curl then I think there are better ways to make sure your timezone is right.

@dreeves dreeves added UVI User-Visible Improvement ADO Consensus needed on what to Actually Do (or "much ado about ∅"), AKA question zzz (closed as) postponed labels Apr 8, 2018
@dreeves
Copy link
Contributor Author

dreeves commented Apr 9, 2018

I'll snooze this now since it's not particularly pressing and there are concerns about the right way to infer timezone, and it could end up moot if we let users choose their timezone in the future and always use that.

@dreeves dreeves closed this as completed Apr 9, 2018
@dreeves dreeves added this to TRIAGE in Commits.to Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADO Consensus needed on what to Actually Do (or "much ado about ∅"), AKA question RFE Request For Enhancement AKA feature request UVI User-Visible Improvement zzz (closed as) postponed
Projects
Commits.to
  
TRIAGE
Development

No branches or pull requests

1 participant