Hi all!
Here is some interesting result with Rails 2.1 (without any specific
TimeZone configuration).
As you will see, adding 3.hours and then 21.hours doesn''t give the same
result as adding 24.hours around DST change!
Loading development environment (Rails 2.1.0)>> t = Time.parse("Sun Oct 26 00:30:00 +0200 2008")
I live in Switzerland, and DST change just happens at 02:00:00
As expected:
>> t2 = t+3.hours
=> Sun Oct 26 02:30:00 +0100 2008
As you can see, the "missing" hour is taken into account, which is
what
you would expect!
Now, let''s add 21 more hours:
>> t2 = t2+21.hours
=> Sun Oct 26 23:30:00 +0100 2008
Which is right, too, since 24.hours have actually passed between the two
displayed dates!
However, now just try the following:
>> t
=> Sun Oct 26 00:30:00 +0200 2008>> t3 = t+24.hours
=> Mon Oct 27 00:30:00 +0100 2008
Huho! There is something wrong here!
Long story short:
>> (t+24.hours)==((t+3.hours)+21.hours)
=> false
Is there anything I am missing?
--
Posted via http://www.ruby-forum.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-/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
-~----------~----~----~----~------~----~------~--~---