On 15 March 2012 15:42, John Merlino <stoici...@aol.com> wrote:
> There wont be a specific timezone, people will use it in all timezones
> and so I would need it to work for everyone.

You are missing the point, unfortunately you seem to have broken the
thread and lost your original example, but the calculation
110.years.ago gave you /exactly/ the right answer (to the second), the
reason it looked wrong is that you were not looking at the time zone
of the answer, so at first glance it looked wrong.  If you make sure
that you display the answer in the same time zone as the original then
it will be what you want.

Colin

>
> This issue started for me when I had this:
>
>
>  validates_inclusion_of :date_of_birth, :in =>
> 110.years.ago.to_datetime..60.years.ago.to_datetime, :message
> => :invalid_age, :allow_nil => true
>
>
> So I trried to add date of birth of 110 years exactly, and it said it
> was an invalid age even though I specify above 110 years ago is ok.
>
> Then I try this:
>
>
>  validates_inclusion_of :date_of_birth, :in =>
> (110.years.ago.to_datetime - 1.days)..
> 60.years.ago.to_datetime, :message => :invalid_age, :allow_nil => true
>
> And thats when it gives me wrong date.
>
> My environment is already set to UTC:
>
> config.time_zone = 'UTC'
>
> thanks for response
>
> --
> 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@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
gplus.to/clanlaw

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to