This project is archived and is in readonly mode.
.utc modifies time object
Reported by SukiSan | May 6th, 2010 @ 03:19 PM
A call to utc modifies the object itself.
t = Time.now => Thu May 06 16:15:14 +0200 2010 t.utc => Thu May 06 14:15:14 UTC 2010 t => Thu May 06 14:15:14 UTC 2010
It shouldn't be like that or the method should be called
.utc!
Comments and changes to this ticket
-
SukiSan May 6th, 2010 @ 03:20 PM
- no changes were found...
-
SukiSan May 6th, 2010 @ 03:26 PM
- Tag changed from utc time zone to utc
hurk, sorry for bad format and the useless change - I'm new here :-)
t = Time.now
=> Thu May 06 16:15:14 0200 2010t.utc
=> Thu May 06 14:15:14 UTC 2010t
=> Thu May 06 14:15:14 UTC 2010 -
ronin-18448 (at lighthouseapp) May 6th, 2010 @ 04:14 PM
I don't think this is a Rails problem, Time is a Ruby class. This has nothing to do with Rails if I'm right.
-
Neeraj Singh May 6th, 2010 @ 04:39 PM
As Simon said it is ruby that is exhibiting the behavior mentioned by Suki.
Suki: In your test the time displayed in the first case and time displayed in the third case is the same time. The only thing is that first one has time in local format and the third one is in UTC format. But the value of t has not changed the way it displays the internal data has changed.
-
SukiSan May 6th, 2010 @ 07:05 PM
Well, yeah sure...
The thing that actually confused me was
date = Time.local(2010, 3, 1)
date.utc
date.end_of_month.utc # == end of febEven that makes sense now. Altough it is confusing that
.utc
has side effects on the object. -
Dan Pickett May 9th, 2010 @ 06:46 PM
- Assigned user set to Ryan Bigg
Passing to Ryan for cleanup. This is a Ruby behavior so this issue should likely be marked as "invalid" or "wontfix"
-
Ryan Bigg May 9th, 2010 @ 10:17 PM
- State changed from new to invalid
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>