2009/6/18 Rick DeNatale <[email protected]>: > > On Thu, Jun 18, 2009 at 8:52 AM, Colin Law<[email protected]> wrote: >> >> 2009/6/18 sinker <[email protected]>: >>> >>> Thanks, that totally makes sense. I just tossed it in the view to make >>> sure it worked. Moved it into the index controller and the final looks >>> like this: >>> >>> if (1..5).include?(Date.today.wday) >>> else >>> redirect_to :controller => 'libraries', :action => 'index' >>> end >>> >> >> Have you considered the time zone issue if this is for a public >> website? Does Date.today know the timezone of the user? If not and >> it works in the local timezone of the server (or maybe the rails >> timezone setting, or UTC) then if a user is in a different timezone >> his weekend may be up to 23 hours adrift from that (depending on the >> server/rails timezone setting). > > You could use > > Time.zone = current_user.timezone # which would probably be in a before_filter
How does current_user.timezone work? Colin > > and then > > Time.zone.now > > instead of Date.today > > > -- > Rick DeNatale > > Blog: http://talklikeaduck.denhaven2.com/ > Twitter: http://twitter.com/RickDeNatale > WWR: http://www.workingwithrails.com/person/9021-rick-denatale > LinkedIn: http://www.linkedin.com/in/rickdenatale > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

