I'd like to not store times in my local timezone, but Sequel is making it really tough on me. I can set them to UTC before I put them in there (a bit of a pain), but then when I take them back out it assumes that they are local dates and then they are all 8 hours in the future. Is this something that hasn't been implemented yet? And if so, are there any workarounds? Thanks!
This is a bit outdated at this point but I believe the best solution here has changed since the original answer was posted. If you set
Sequel.default_timezone = :utc
sequel will treat all times as UTC and wont exhibit the behavior described in the question.
Find more info at http://sequel.jeremyevans.net/rdoc/classes/Sequel/Timezones.html
Just had a very similar issue myself.
This information has been taken from the Sequel RDoc
Sequel can use either Time or DateTime for times returned from the database. It defaults to Time. To change it to DateTime, use:
Sequel.datetime_class = DateTime
Also make sure your not storing the timezone information in your database. I'm using Postgres and the column type is timestamp without time zone.
This should result in the displayed Date/Time being in UTC. It has worked for me when passing in a Date/Time of 2009-07-13T03:22:53Z the result is displayed as 2009-07-13T03:22:53+00:00
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With