zip_to_timezone 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +28 -0
- data/VERSION +1 -1
- data/lib/zip_to_timezone.rb +1 -6
- data/spec/spec_helper.rb +2 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -2,6 +2,34 @@
|
|
2
2
|
|
3
3
|
This gem is designed to map US postal codes to the timezone. The timezone strings are based on ActiveSupport::TimeZone settings that include basic DST information. If used with Rails these timezones will handle DST changes on their own.
|
4
4
|
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
gem install zip_to_timezone
|
8
|
+
|
9
|
+
This gem is hosted on gemcutter so you may need to add it as a source:
|
10
|
+
|
11
|
+
gem install gemcutter
|
12
|
+
gem tumble
|
13
|
+
|
14
|
+
== Usage
|
15
|
+
|
16
|
+
This is super simple to use:
|
17
|
+
|
18
|
+
ZipToTimezone.get_timezone_for('91304') # => "Pacific Time (US & Canada)"
|
19
|
+
|
20
|
+
== How it works
|
21
|
+
|
22
|
+
This uses Trei longest prefix matching to speed up the searching. This means that all zip codes that start with 90 will be in California and therefore are in Pacific Time. If I need to match on full zip codes in some states to differentiate timezones I can do that (eg: Kansas or Indiana) by just adding more specific entires.
|
23
|
+
|
24
|
+
== Note on accuracy
|
25
|
+
|
26
|
+
This gem combines two things that kind of suck to make them suck less. To do this though I had to make a lot of guesses. Please let me know if there are bad mappings so I can fix them. My data is imperfect and in some places outright wrong. The goal of the project was to handle the 95% case and hopefully grow it to be more accurate over time.
|
27
|
+
|
28
|
+
== References
|
29
|
+
|
30
|
+
* http://www.worldtimezone.com/time-usa12.php
|
31
|
+
* http://en.wikipedia.org/wiki/ZIP_code_prefixes
|
32
|
+
|
5
33
|
== Note on Patches/Pull Requests
|
6
34
|
|
7
35
|
* Fork the project.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/zip_to_timezone.rb
CHANGED
data/spec/spec_helper.rb
CHANGED