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. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Thu, Jan 29, 2009 at 3:11 PM, stephen O''D <stephen.odonnell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > I haven''t worked with time zones yet but a quick search returned thishttp://mad.ly/2008/04/09/rails-21-time-zone-support-an-overview/which has > some mentions of daylight savings. >Yea I have been through one. Its helps with one off events, but not recurring ones or if someone needs to change their timezone, which pretty much turns it all on its head. I am hoping someone has some experience of what I want to do and can share some lessons learned or tricks they used. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---