[Rails] Re: 110.years.ago.to_datetime returns wrong date

2012-03-15 Thread Frederick Cheung
On Mar 15, 3:42 pm, John Merlino wrote: > And thats when it gives me wrong date. > > My environment is already set to UTC: > > config.time_zone = 'UTC' > > thanks for response That's why the answer was march 14th. You say that the date was march 13th 2012, but in the timezone you were doing yo

Re: [Rails] Re: 110.years.ago.to_datetime returns wrong date

2012-03-15 Thread Colin Law
On 15 March 2012 15:42, John Merlino 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.y

[Rails] Re: 110.years.ago.to_datetime returns wrong date

2012-03-15 Thread John Merlino
There wont be a specific timezone, people will use it in all timezones and so I would need it to work for everyone. 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

[Rails] Re: 110.years.ago.to_datetime returns wrong date

2012-03-14 Thread Robert Walker
Fernando Almeida wrote in post #1051362: > What is your timezone? for timezone 0 is 14 =) Yea. Date math is way more complicated than one might originally guess. Explains why there's about 15 different Date and Calendar implementations in Java and very few of them are accurate over long time pe