Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

datetime values incorrectly get marked as changed #12459

Closed
bpardee opened this Issue · 4 comments

4 participants

@bpardee

Datetime values incorrectly get marked as changed when their parsed from a string with a different timezone.

> a
=> #<Appointment id: 263982, start_at: "2013-08-26 18:00:00", end_at: "2013-08-26 18:30:00">
> a.start_at = a.start_at.to_s
=> "2013-08-26 18:00:00 UTC"
> a.changes
=> {}
> a.start_at = a.start_at.in_time_zone("Eastern Time (US & Canada)")
=> Mon, 26 Aug 2013 14:00:00 EDT -04:00
> a.changes
=> {}
> a.start_at = a.start_at.in_time_zone("Eastern Time (US & Canada)").to_s
=> "2013-08-26 14:00:00 -0400"
> a.changes
=> {"start_at"=>[Mon, 26 Aug 2013 18:00:00 UTC +00:00, Mon, 26 Aug 2013 18:00:00 UTC +00:00]}
@senny
Owner

Can you write an executable test-case to reproduce the problem? You can use this gist as a starting point.

@bpardee

My apologies for not doing due diligence. This looks to be fixed in 4.1.0beta

@bpardee bpardee closed this
@robin850
Collaborator

@bpardee : Thanks for reporting but is it fixed on the 4-0-stable branch please ? If it's not the case, we need to backport the commit which fixed it.

@bpardee

It looks like it's a problem parsing times of the form "2009-02-13 18:31:30 -0500" although I'm not sure why my project using postgres and UTC timezones seems to parse it correctly but still mark it as changed. The test program below works on the latest but not in 4-0-stable.

https://gist.github.com/bpardee/6961999

@bpardee bpardee reopened this
@georgeguimaraes georgeguimaraes referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@georgeguimaraes georgeguimaraes referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@georgeguimaraes georgeguimaraes referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@georgeguimaraes georgeguimaraes referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@georgeguimaraes georgeguimaraes referenced this issue from a commit in georgeguimaraes/rails
@kennyj kennyj ActiveRecord::ConnectionAdapters::Column.string_to_time method respec…
…ts string with timezone.

Closes #12278
Closes #12459

Conflicts:
	activerecord/CHANGELOG.md
9e82331
@georgeguimaraes georgeguimaraes referenced this issue from a commit in georgeguimaraes/rails
@georgeguimaraes georgeguimaraes Add integration test for #12459 2b3a41f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.