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
haileys wants to merge 1 commit into3-0-githubfrom
3-0-github+tz-fixes
Open

Convert DateTime to Time before quoting#68
haileys wants to merge 1 commit into3-0-githubfrom
3-0-github+tz-fixes

Conversation

@haileys
Copy link
Copy Markdown

@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