On Thu, Jan 29, 2009 at 3:11 PM, stephen O'D <[email protected]>wrote:

>
> I have an app that stores appointments.
>
> Appointments can recur daily, weekly etc or just be one off.
>
> The application needs to notify users 15 minutes before each
> appointment.
>
> Now, I know that I can use various Rails 2.1 features to help with
> TimeZones such as Time.zones, but what I am not sure about is daylight
> savings and these recurring reminders and people changing their
> timezones.
>
> Lets say a user creates a daily reminder for 1pm in their timezone,
> say UTC -5 - ActiveRecord stores it at 6pm UTC.
>
> Later in the year, due to daylight savings, their timezone becomes UTC
> -4, and all of a sudden, their appointment shifts by 1 hour.
>
> Also, if a user flies off on business, and their timezone becomes UTC
> +5, all the appointments will be totally at the wrong time.
>
> I am wondering what the best practice for this sort of scenario is?
> Should I always store local times in my database (ie if a user wants
> an appointment at 1pm, just store 1pm) and then the logic that sends
> reminders needs to get a time and adjust it to UTC to figure out when
> to send the reminder?  That allows me to change reminders, and handle
> daylight savings correctly, at the expense of complex reminder logic.
>
> I struggle to think of a way of handling daylight saving around daily
> appointments etc if I store appointments normalised to UTC in my
> database?
>
> Opinions, comments and best practices all appreciated!
>
> Thanks,
>
> Stephen.
> >
>
I haven't worked with time zones yet but a quick search returned this
http://mad.ly/2008/04/09/rails-21-time-zone-support-an-overview/ which has
some mentions of daylight savings.

-- 
Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to