I basically want to auto-determine the user's timezone using Rails. I can use this JS code in the user's browser ( http://www.onlineaspect.com/2007/06/08/auto-detect-a-time-zone-with-javascript/ ) to submit the form with a UTC offset and the fact that the time zone observes DST in summer or not in the user's time zone.
As soon as I have this information on the server, I want to select the appropriate time zone. In Rails, I can get a list of time zones with ActiveSupport :: TimeZone.all. In addition, I can filter zones using utf offset thanks to the utc_offset method. However, I do not know how to filter the time slots that perform / do not perform DST.
eg. Suppose a user lives in Amsterdam. UTC offset filtering will return Berlin, Belgrade, Madrid, etc., as well as West Central Africa. All of them, but West Central Africa, would be suitable time zones for the user in Amsterdam (as they provide the same time / date), but I need to filter out West Central Africa, which does not have daylight saving in summer.
How to do it in Rails? Also, are any of my assumptions wrong?
source share