How to save an event in Berlin with your specific time zone and the next event in Tijuana with another?
The user is prompted to select a city for the event, as a source, for example. +02 :. 00
I would like to get a temporary code like this:
eventstart = "2011-07-22T18:00:00+02:00"
How are you going to create this form?
UPDATE:
Implemented retention as standard UTC is excellent for many reasons. So now I am changing the time line in the view to represent * distance_to_time_in_words * for eventstart, depending on the local time of the user.
Event in Tijuana, view from Berlin time:
old_zone = Time.zone #=> "Berlin" Time.zone = "Tijuana" t = Time.zone.parse(eventstart.to_s[0..-7]) #=> 2011-07-22 18:00:00 +08:00 Time.zone = old_zone #=> "Berlin" distance_of_time_in_words(Time.now.in_time_zone, t) #=> "9 hours"
bulky, but it works for now. Improvement ideas are welcome!
David source share