Skip to content
This repository was archived by the owner on May 5, 2020. It is now read-only.

Convert DateTime to Time before quoting #68

Open
wants to merge 1 commit into
base: 3-0-github
Choose a base branch
from

Conversation

haileys
Copy link

@haileys haileys commented May 14, 2014

DateTime does not respond to getlocal, so the current quoting is wrong for DateTimes when the database is in local time: https://github.com/github/rails/blob/3-0-github/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb#L65-66

[34] pry(#<GitHubSQLContext>)> datetime_local
=> Wed, 14 May 2014 16:17:30 +1000
[35] pry(#<GitHubSQLContext>)> datetime_utc
=> Wed, 14 May 2014 06:17:30 +0000
[36] pry(#<GitHubSQLContext>)> ActiveRecord::Base.connection.quote(datetime_local)
=> "'2014-05-14 16:17:30'"
[37] pry(#<GitHubSQLContext>)> ActiveRecord::Base.connection.quote(datetime_utc)
=> "'2014-05-14 06:17:30'"

cc @github/timezones @github/rails3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant