farski / tzip Goto Github PK
View Code? Open in Web Editor NEWSimplifies defining time zones in Rails apps with ZIP codes.
Home Page: https://github.com/farski/TZip
Simplifies defining time zones in Rails apps with ZIP codes.
Home Page: https://github.com/farski/TZip
The AZ zip prefix is wrong. It's listed as 0,1,2 (same as eastern).
I think it should be 85,86 (based on https://secure.wikimedia.org/wikipedia/en/wiki/Zipcode)
See the change on my rails 2 compatible fork:
https://github.com/Katlean/TZip/commit/65d53614104dd2ec6d9c2560094cb06df6408692
Is this gem / repo licensed for free and open source usage?
It's great that TZip allows you to assign the output of #find_by_zipcode to config.time_zone.
But for those of us working in Ruby only environments (non-rails) it would be nifty if TZip could produce names suitable for assigning to ENV[TZ]. For example, "Pacific Time (US & Canada)" would be "US/Pacific". Etc.
This would allow something like:
ENV['TZ'] = TZip::tz_from_zipcode(90266)
irb(main):001:0> ActiveSupport::TimeZone.find_by_zipcode('37212')
=> nil
irb(main):001:0> ActiveSupport::TimeZone.find_by_zipcode('37212')
=> "Central Time (US & Canada)"
irb(main):001:0> ActiveSupport::TimeZone.find_by_zipcode('37212')
=> nil
Rails version: Rails 5.0.0.1
Ruby version: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]
Steps to reproduce
pry(main)> ActiveSupport::TimeZone.find_by_zipcode('8628')
=> nil
Expected behavior
pry(main)> ActiveSupport::TimeZone.find_by_zipcode('8628')
=> "Eastern Time (US & Canada)"
Actual behavior
pry(main)> ActiveSupport::TimeZone.find_by_zipcode('8628')
=> nil
System configuration
Rails version: Rails 5.0.6
Ruby version: ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin16]
ActiveSupport::TimeZone.find_by_zipcode('40383')
=> nil
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.