views:

544

answers:

4

I am working on a Rails app that displays a sports schedule (in a basic table). Each game/event is a db table row. The customer wants all the events to display in chronological order but to also display the time in the event's local timezone.

How can I add a timezone selector to the New action? So that when the customer enters events they can select the event's timezone and input the event's time in that timezone.

Here is what the schedule would look like:

Event 1 7:00 pm EST Event 2 5:00 pm PST Event 3 7:00 pm PST

I personally think this is confusing, but it's what they want. Thanks in advance.

+1  A: 

Geoff Buesing wrote a great primer on Rails support of time zones back when 2.1 was released.

jdl
I had actually just read that. I am looking for a way to do this wihtout logging people in and I want to list in multiple timezones, not just one.
JetShred
Right. Take the example that he gave for users and apply that to events.
jdl
A: 

Okay I am not so sure I understood your question directly but here is my line of thinking there is a library I passed along called tzinfo which is supposed to give Rails the ability to work with timezones so my guess is do the following build a list for a select box (wikipedia has a good complete list) when the user selects the timezone send it to the server which will calculate the appropriate timings now and send back (maybe depending on your architecture you could send only the added hours that should be added or subtracted)

Mackram
A: 

Hey JetShred,

I am in a similar situation as yours. How did you get around the problem??

Thanks a ton in advance

dewdrops
A: 

I was dealing with a similar issue. Check out http://stackoverflow.com/questions/1430219/how-to-deal-with-time-zones-in-a-rails-app-with-events for how I worked through it.

John