This project is archived and is in readonly mode.
ActiveRecord::Base minimum and maximum methods do not return datetimes in local timezone
-
Geoff Buesing
- State changed from new to wontfix
Hmm I think the current behavior actually makes sense here -- the time zone conversions are done with custom attribute reader and writer methods; i.e., they read and write values to the attributes hash. A calculation doesn't involve the attributes hash at all.
Similarly, if you created a custom reader method for, say, a length method, that read_attribute(:length) and converted from meters to feet or whatever, this conversion wouldn't be invoked for a :minimum calculation, either -- you'd get back the minimum value in whatever scale the db stored it in.
-
Sean Kirby
If the behaviour isn't going to get changed, how about a clarification in the docs that this method is going directly to the db? That would at least make this behaviour more obvious.