Hi guys, This ugrade to 3.0.10 is giving me headaches. Using 3.0.3, the time zone was set at Brisbane. All times parsed from the params are correctly parsed, ie in the browser, the time is set to Aug 23, 2011 2:52pm so in the server, you''d expect the param to be Tue, 23 Aug 2011 14:52:00 EST +10:00. This is in Rails 3.0.3 and works great. In Rails 3.0.10, the same time would parse to Wed, 24 Aug 2011 00:52:00 EST +10:00, an offset of 10 hours, which is caused by the +10 offset of Brisbane''s timezone with UTC. What''s the correct behavior? Any advice on how to get the behavior in 3.0.3? Thanks! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 August 2011 08:55, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi guys, > > This ugrade to 3.0.10 is giving me headaches. Using 3.0.3, the time zone > was set at Brisbane. All > times parsed from the params are correctly parsed, ie > in the browser, the time is set to Aug 23, 2011 2:52pm so in the server, > you''d expect the param to be > Tue, 23 Aug 2011 14:52:00 EST +10:00. This is in Rails 3.0.3 and works > great. > In Rails 3.0.10, the same time would parse to Wed, 24 Aug 2011 00:52:00 EST > +10:00, an offset of 10 hours, > which is caused by the +10 offset of Brisbane''s timezone with UTC. > What''s the correct behavior? Any advice on how to get the behavior in > 3.0.3? Thanks!Assuming the date is being posted from a form, what are the actual values in the params hash and how are you parsing that? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Aug 23, 2011 at 4:00 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 23 August 2011 08:55, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi guys, > > > > This ugrade to 3.0.10 is giving me headaches. Using 3.0.3, the time zone > > was set at Brisbane. All > > times parsed from the params are correctly parsed, ie > > in the browser, the time is set to Aug 23, 2011 2:52pm so in the server, > > you''d expect the param to be > > Tue, 23 Aug 2011 14:52:00 EST +10:00. This is in Rails 3.0.3 and works > > great. > > In Rails 3.0.10, the same time would parse to Wed, 24 Aug 2011 00:52:00 > EST > > +10:00, an offset of 10 hours, > > which is caused by the +10 offset of Brisbane''s timezone with UTC. > > What''s the correct behavior? Any advice on how to get the behavior in > > 3.0.3? Thanks! > > Assuming the date is being posted from a form, what are the actual > values in the params hash and how are you parsing that? > >Hey Colin, Yes, the dates are being posted from the form. And I don''t do any special parsing, I just assign the params to a record using either #new or #update_attributes. To make it clearer, @post = Post.new params[:post] # params[:post][:start_at] contains the time string from the form Assuming that params[:post][:start_at] = Aug 23, 2011 2:52pm>> @post.start_at # Tue, 23 Aug 2011 14:52:00 EST +10:00 for 3.0.3 >> @post.start_at # Wed, 24 Aug 2011 00:52:00 EST +10:00 for 3.0.10> Colin > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 August 2011 12:00, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Tue, Aug 23, 2011 at 4:00 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 23 August 2011 08:55, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > Hi guys, >> > >> > This ugrade to 3.0.10 is giving me headaches. Using 3.0.3, the time >> > zone >> > was set at Brisbane. All >> > times parsed from the params are correctly parsed, ie >> > in the browser, the time is set to Aug 23, 2011 2:52pm so in the server, >> > you''d expect the param to be >> > Tue, 23 Aug 2011 14:52:00 EST +10:00. This is in Rails 3.0.3 and works >> > great. >> > In Rails 3.0.10, the same time would parse to Wed, 24 Aug 2011 00:52:00 >> > EST >> > +10:00, an offset of 10 hours, >> > which is caused by the +10 offset of Brisbane''s timezone with UTC. >> > What''s the correct behavior? Any advice on how to get the behavior in >> > 3.0.3? Thanks! >> >> Assuming the date is being posted from a form, what are the actual >> values in the params hash and how are you parsing that? >> > > Hey Colin, > Yes, the dates are being posted from the form. And I don''t do any special > parsing, I just assign the > params to a record using either #new or #update_attributes. To make it > clearer, > @post = Post.new params[:post] # params[:post][:start_at] contains the time > string from the form > Assuming that params[:post][:start_at] = Aug 23, 2011 2:52pm >>> @post.start_at # Tue, 23 Aug 2011 14:52:00 EST +10:00 for 3.0.3 >>> @post.start_at # Wed, 24 Aug 2011 00:52:00 EST +10:00 for 3.0.10So it appears that 3.0.3 is taking the string as local time, but 3.0.10 was taking it as UTC. I would have thought that assuming UTC was probably the best choice for rails to make, as it has no way of knowing what timezone the user is in. It is a bit dangerous to allow the user to enter a string and then let Rails parse it (if that is what you are doing). There are many ways the user could enter an invalid string. Make sure you catch the exceptions. If you know what timezone the user is in then you could append that to the start_at string in params before using it. Colin> >> >> Colin >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> > > > > -- > ------------------------------------------------------------- > visit my blog at http://jimlabs.heroku.com > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Aug 23, 2011 at 7:33 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 23 August 2011 12:00, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > On Tue, Aug 23, 2011 at 4:00 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > >> > >> On 23 August 2011 08:55, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > Hi guys, > >> > > >> > This ugrade to 3.0.10 is giving me headaches. Using 3.0.3, the time > >> > zone > >> > was set at Brisbane. All > >> > times parsed from the params are correctly parsed, ie > >> > in the browser, the time is set to Aug 23, 2011 2:52pm so in the > server, > >> > you''d expect the param to be > >> > Tue, 23 Aug 2011 14:52:00 EST +10:00. This is in Rails 3.0.3 and > works > >> > great. > >> > In Rails 3.0.10, the same time would parse to Wed, 24 Aug 2011 > 00:52:00 > >> > EST > >> > +10:00, an offset of 10 hours, > >> > which is caused by the +10 offset of Brisbane''s timezone with UTC. > >> > What''s the correct behavior? Any advice on how to get the behavior in > >> > 3.0.3? Thanks! > >> > >> Assuming the date is being posted from a form, what are the actual > >> values in the params hash and how are you parsing that? > >> > > > > Hey Colin, > > Yes, the dates are being posted from the form. And I don''t do any > special > > parsing, I just assign the > > params to a record using either #new or #update_attributes. To make it > > clearer, > > @post = Post.new params[:post] # params[:post][:start_at] contains the > time > > string from the form > > Assuming that params[:post][:start_at] = Aug 23, 2011 2:52pm > >>> @post.start_at # Tue, 23 Aug 2011 14:52:00 EST +10:00 for 3.0.3 > >>> @post.start_at # Wed, 24 Aug 2011 00:52:00 EST +10:00 for 3.0.10 > > So it appears that 3.0.3 is taking the string as local time, but > 3.0.10 was taking it as UTC. I would have thought that assuming UTC > was probably the best choice for rails to make, as it has no way of > knowing what timezone the user is in. It is a bit dangerous to allow > the user to enter a string and then let Rails parse it (if that is > what you are doing). There are many ways the user could enter an > invalid string. Make sure you catch the exceptions. If you know what > timezone the user is in then you could append that to the start_at > string in params before using it. > >What I''m saying here is that the behavior changed from 3.0.3 to 3.0.10. Validating the user input is beside the point. What I''m pointing out is all time inputs that''s going to be parsed by rails when the app is using 3.0.10 will be in UTC by default, even when you set the time zone to be anything other than UTC.> Colin > > > > >> > >> Colin > >> > >> -- > >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> To unsubscribe from this group, send email to > >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> For more options, visit this group at > >> http://groups.google.com/group/rubyonrails-talk?hl=en. > >> > > > > > > > > -- > > ------------------------------------------------------------- > > visit my blog at http://jimlabs.heroku.com > > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Aug 23, 2:00 pm, Jim Ruther Nill <jvn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > What I''m saying here is that the behavior changed from 3.0.3 to 3.0.10. > Validating the user input > is beside the point. What I''m pointing out is all time inputs that''s going > to be parsed by rails when > the app is using 3.0.10 will be in UTC by default, even when you set the > time zone to be anything > other than UTC. >First off, the times you give are 14 hours out not 10 (not sure if that is relevant). Secondly, is what is in the params a string containing the entire date/ time ?(as opposed to what you get if you use select_datetime, where you get one parameter for each component) If so then https://github.com/rails/rails/commit/c5908a86492271ca55a6f54ccfd62b521cdc47c9 seems to be the relevant change in rails Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 23 August 2011 14:14, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Aug 23, 2:00 pm, Jim Ruther Nill <jvn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> What I''m saying here is that the behavior changed from 3.0.3 to 3.0.10. >> Validating the user input >> is beside the point. What I''m pointing out is all time inputs that''s going >> to be parsed by rails when >> the app is using 3.0.10 will be in UTC by default, even when you set the >> time zone to be anything >> other than UTC. >> > > First off, the times you give are 14 hours out not 10 (not sure if > that is relevant).I don''t think you are right there, Fred. Aug 23 2:52pm plus 10 hours is Aug 24, 00:52 Colin> Secondly, is what is in the params a string containing the entire date/ > time ?(as opposed to what you get if you use select_datetime, where > you get one parameter for each component) > If so then https://github.com/rails/rails/commit/c5908a86492271ca55a6f54ccfd62b521cdc47c9 > seems to be the relevant change in rails > > Fred > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Aug 23, 2011 at 9:14 PM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Aug 23, 2:00 pm, Jim Ruther Nill <jvn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > What I''m saying here is that the behavior changed from 3.0.3 to 3.0.10. > > Validating the user input > > is beside the point. What I''m pointing out is all time inputs that''s > going > > to be parsed by rails when > > the app is using 3.0.10 will be in UTC by default, even when you set the > > time zone to be anything > > other than UTC. > > > > First off, the times you give are 14 hours out not 10 (not sure if > that is relevant). >hmm.. i think it''s 10 hours.> Secondly, is what is in the params a string containing the entire date/ > time ?(as opposed to what you get if you use select_datetime, where > you get one parameter for each component) > If so then > https://github.com/rails/rails/commit/c5908a86492271ca55a6f54ccfd62b521cdc47c9 > seems to be the relevant change in rails > >Wow! thanks for this. I''ll take a look and report back. Thanks!> Fred > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.