Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Add documentation about how Time/Date is handled in Sequel #585
Databases have various datatypes that store time and date. Is there documentation about how Sequel deals with those data types?
I can't find anywhere in the documentation that tells you how time zones are handled, for example. Do timestamp with timezone types maintain their timezone in Ruby land? If not, how are they converted? How are timestamp without timezone types converted to Ruby Time/DateTime?
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
I don't think there is any specific documentation on this issue, and I'm not sure it's worth adding. If you feel strongly about the issue, please submit a pull request.
Not all databases support timezones in their timestamp types, and for those that do, they may not actually store the timezone. PostgreSQL at least converts everything to UTC internally, so if you put in a timestamp with +0600, you generally do not get a timestamp back with +0600 unless that is the local timezone for the retrieving client (though whatever value you get will be equivalent).
How timestamp types are converted upon retrieval depends on the underlying driver. If the driver returns the type as a string, Sequel will attempt to convert it using Time/DateTime.parse. In generally, timestamp with timezone and timestamp without timezone are treated the exact same way by Sequel, though the database treats the types differently.