I have events that can be in different time zones.
Upon edit I want the time & date to show with the time zone of that very event.
However, when I hit edit, datetime_select
always shows the time of the users time zone (as opposed to the one of the event).
Example:
- Event starting at 10 a.m. in Amsterdam (GMT+1)
- Users time zone configured as London (GMT+0)
Result: Upon edit the event time is falsely preset to 9 a.m.
Code snippet:
def edit
Time.zone = @event.time_zone
@event.beginn = @event.beginn.in_time_zone
@event.endd = @event.endd.in_time_zone
# [...]
end
Note that @event.time_zone contains the desired time zone ("Amsterdam" in the above example).
How can I have datetime_select
preset to the events time in it's respective zone upon edit?