
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
TimeTraveler finds timezones based on geographical coordinates using offline data and Quadtree lookups intead of an online API.
Add this line to your application's Gemfile:
gem 'tz-traveler'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tz-traveler
Find a timezone for a geographical coordinate (WGS84) like so:
require 'time_traveler'
TimeTraveler.find_timezone(77.2090210, 28.6139390)
The TimeTraveler gem contains a rather large blob which is in reality a JSON document describing a full Quadtree with all the cities contained in the GeoNames "Free Gazetteer extract" file cities15000.zip which contains "cities with a population > 15000 or capitals (ca 25.000)".
The Quadtree datastructure contains only the WGS84 coordinates and the IANA timezone for each city, so that it's really just big set of time zones at different places on the earth.
This Quadtree can be rebuilt periodically from the latest version available from GeoNames.
The cities15000.zip file is downloaded from GeoNames Free Gazetteer Data where it is made available under a Creative Commons Attribution 4.0 License.
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Bug reports and pull requests are welcome on Bitbucket at https://github.com/janlindblom/ruby-timetraveler. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Geographical data from the GeoNames Free Gazetteer extract cities15000.zip file is used under the Creative Commons Attribution 4.0 License.
The embedded JSON data structure contained in the TimeTraveler gem constructed from this data is to be considered an adapted work in accordance with this license.
Everyone interacting in the TimezoneCalculator project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that tz-traveler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.