Handling cases when a timezone isn't applicable

I've run into the following issue:

My app has multiple users from multiple timezones. In the majority of
cases, I want datetime columns to take into account the user's
timezone. This works fine.

However, for *one* particular datetime field, I want users to enter
the arrival date & time of a flight that is arriving into a country in
a different timezone to the user's timezone. Hence I don't want any
timezone conversion done on this particular field.

e.g. a user in Germany enters the data for a flight that will arrive
in New Zealand on January 1st at 2:00pm. When a different user views
this data, I want it to say 2:00pm, regardless of the user's timezone.

I don't see that the datetime_select helper allows me to specify a
timezone for the time I am selecting; but anyway, I don't want the
user to have to enter a timezone.

I suppose the easiest (only?) solution is to store the data in
separate date and time fields in the database, and use separate
date_select and time_select helpers.

Any comments? Should this functionality be something that datetimes /
datetime_select should support?



You can currently opt out of time zone aware attributes for specific
attributes like so:

class Flight < ActiveRecord::Base
  self.skip_time_zone_conversion_for_attributes =
[:departure_time, :arrival_time]

With this setup, no time zone conversions will be done for
Flight#departure_time and #arrival time.

Does this give you what you need?


Yes! That's exactly what I need. Thank you very much -- far nicer than
overriding arrival_time and arrival_time= which is what I had ended up