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

Guess timezone by population #274

Merged
merged 10 commits into from
Dec 10, 2015

Conversation

timrwood
Copy link
Member

This adds a few improvements on guessing timezones.

All current timezones now have a rough population estimate to help as a tiebreaker. The populations are based on https://en.wikipedia.org/wiki/List_of_urban_areas_by_population and googling X population. We are not incredibly concerned with accuracy here, one digit of precision is usually enough to differentiate between two similar zones.
2. The timezone's abbreviation is taken into consideration if possible.
3. The scoring algorithm is more granular. We take a handful of samples of the offsets and abbrs in the 4 years surrounding the current year using the binary search from #256. We then compare each zone's offsets and abbrs at those times with the browser reported offsets and abbrs.
4. Sorting is done first by offset differences in minutes, then by differences in abbrs, then by population. The end result is that we should be able to distinguish ~190 zones (see this commit) with browser abbr information, and ~60 without browser abbr information.

The next step after this is merged is to pre-filter guesses here so that we are not unpacking every zone when guessing the zone.

cc @mj1856

@mattjohnsonpint
Copy link
Contributor

Acknowledged, but I'm tied up for a bit. May be some time before I can get to reviewing. Thanks.

@timrwood
Copy link
Member Author

I'm going to merge this in order to continue progress.

It will still be on the guess-timezone branch, so there is still time for review before merging into master.

timrwood added a commit that referenced this pull request Dec 10, 2015
@timrwood timrwood merged commit 33a2ea4 into moment:guess-timezone Dec 10, 2015
@timrwood timrwood deleted the guess-timezone-scoring branch December 10, 2015 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants