I am encountering the classic ‘hosting timezone different from customer
timezone’ problem. The hosting timezone is CST, but users all over the
world are visiting the site.
I understand I can make the Timezone selection a user preference and use
TZInfo (http://tzinfo.rubyforge.org/) to do the math.
But, is there anyway to infer the client timezone from the HTTP headers
or the request object?
I am encountering the classic ‘hosting timezone different from customer
timezone’ problem. The hosting timezone is CST, but users all over the
world are visiting the site.
I understand I can make the Timezone selection a user preference and use
TZInfo (http://tzinfo.rubyforge.org/) to do the math.
But, is there anyway to infer the client timezone from the HTTP headers
or the request object?
Not in Firefox 2.0 on the mac at least… I don’t think I’ve ever heard
of this anywhere though… would be a nice feature though.
I am encountering the classic ‘hosting timezone different from customer
timezone’ problem. The hosting timezone is CST, but users all over the
world are visiting the site.
I understand I can make the Timezone selection a user preference and use
TZInfo (http://tzinfo.rubyforge.org/) to do the math.
But, is there anyway to infer the client timezone from the HTTP headers
or the request object?
Not in Firefox 2.0 on the mac at least… I don’t think I’ve ever heard
of this anywhere though… would be a nice feature though.
Thanks for your reply Philip.
Yes, it would be a great feature. Perhaps, we should place a request to
firefox-dev to add this in their future releases. Once firefox does this
everyone else will follow - just like all the other nice features in
firefox.
You could do this by getting the user’s ip, doing a location lookup and
then matching the country/state with a timezone. It would be a bit
inaccurate (esp. since some cities run on timezones different to the
rest of the state/province).
You could do this by getting the user’s ip, doing a location lookup and
then matching the country/state with a timezone. It would be a bit
inaccurate (esp. since some cities run on timezones different to the
rest of the state/province).
Thanks.
But, I dont think it will work - 2 issues:
Doing this for every single client (since the value could be saved in
the session handle for subsequent requests) will make it prohibitively
expensive.
I only know websites that can do this lookup. How to do this
programmatically? Once, I get a city/country name for the IP, how can
that be programmatically mapped to a timezone? I do not have any idea if
this is even possible!
Seems like the cost/pain is much more than the benefit. I would rather
add a TIMEZONE user preference instead of doing this.
But how to cache your pages if you have to compute the time/date for
every user?
I dunno anything about your website, but relative time (10 minutes ago,
1 hour ago…) ala gmail might be an option to solve the cache/user pref
pb. You just have to time-out the cache every ten minutes or so and
compute the elapsed time is very easy in rails.Yet if your app is an
agenda like application, just forget everything I said.
Anyone know whats the best channel to do that?
Probably won’t happen… even if Firefox did it, that’s what only 20% of
the users… until IE does it, it’s not reliable… and even then isn’t
reliable until everyone upgrades…
But how to cache your pages if you have to compute the time/date for
every user?
I dunno anything about your website, but relative time (10 minutes ago,
1 hour ago…) ala gmail might be an option to solve the cache/user pref
pb. You just have to time-out the cache every ten minutes or so and
compute the elapsed time is very easy in rails.Yet if your app is an
agenda like application, just forget everything I said.