Has anyone found a good solution for setting the Rails Time.zone from
a lat/long pair? I’ve been wrestling around with this.
The closest I can come is using the geonames API, but the problem is I
haven’t found anything that will do a decent job of converting from
their time zone namespace over to the Rails time zone namespace.
There are some hacks out there that use the UTC or GMT offset and
convert by finding a time zone with the same UTC offset between the
Geonames and Rails time zone sets. Unfortunately, it’s not a very good
hack because it ignores the fact that you might have multiple time
zones of different countries within the same UTC offset but with
different policies around daylight savings time. No to mention that
it’s a little wonky when someone enters a location near Capetown,
South Africa and the routine assigns them to the time zone for
Is there anything that will do a better job of mapping, or am I just
using the wrong method entirely (i.e. is there a way to do this
without using the Geonames service at all?) It seems to me this is
probably something that has to be a service type situation, since
making a static mapping of all the time zones and then maintaining it
is probably impractical for a small site.