This project is archived and is in readonly mode.
Time columns do not support time zones
-
Ernie Miller
I'm not sure I agree on this one. When only time, and not date is being persisted in the database, part of the information required to make an intelligent decision about conversion is missing. Namely, the ability to discern whether the time is during daylight savings time or not.
You could say the assumption should be made that the current date should be used for determining offset from UTC, but at that point, I'd contend you're not really dealing with a persisted attribute of the model at all, but instead a derived value from the persisted data. That makes a pretty strong case for you to do your own conversion if that's what you want.
I'd have to give this one a -1.
-
Geoff Buesing
- Assigned user set to Geoff Buesing
- Tag changed from 2.1, activerecord, patch, tiny to 2.1, activerecord, patch
To do time zone conversions, you need to work with specific points in time, and in order to convert a db time identifier like "12:30:00" to a specific point in time, you'd need to make an assumption about a date and a zone.
I'm in agreement with Ernie here, these assumptions sound like they belong in application code, not Rails.
Also, I'm not sure your example gives a compelling use case for time-only columns -- couldn't "next day by a certain time" be turned into a specific UTC time point, and stored in the db in a datetime column?
-
Connor McKay
Its a bit late to comment now, but I have to say that after I thought about it more, I think I do have to agree that this is an application assumption.
