Skip to content

Commit

Permalink
fix odd timezone bug when saving articles
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1978 567b1171-46fb-0310-a4c9-b4bef9110e78
  • Loading branch information
technoweenie committed Sep 2, 2006
1 parent 414967b commit 2747e83
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -1,5 +1,7 @@
* SVN *

* fix odd timezone bug when saving articles

* fix bug with <typo:code> macro

* bad feed urls raise ActiveRecord::RecordNotFound, and return 404 in production
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/articles_controller.rb
Expand Up @@ -137,7 +137,7 @@ def convert_times_to_utc
date = Time.parse_from_attributes(params[:article], :published_at, :local)
next unless date
params[:article].delete_if { |k, v| k.to_s =~ /^#{:published_at}/ }
params[:article][:published_at] = date.utc
params[:article][:published_at] = utc_to_local(date)
end
end

Expand Down
6 changes: 3 additions & 3 deletions test/functional/admin/articles_controller_test.rb
Expand Up @@ -90,7 +90,7 @@ def test_should_create_article
'published_at(1i)' => '2005', 'published_at(2i)' => '1', 'published_at(3i)' => '1', 'published_at(4i)' => '10' }, :submit => :save
assert_redirected_to :action => 'index'
assert assigns(:article).published?
assert_equal Time.local(2005, 1, 1, 9, 0, 0).utc, assigns(:article).published_at
assert_equal Time.utc(2005, 1, 1, 5, 0, 0), assigns(:article).published_at
assert !assigns(:article).new_record?
assert_equal users(:quentin), assigns(:article).updater
end
Expand Down Expand Up @@ -181,7 +181,7 @@ def test_should_update_article_with_correct_time
post :update, :id => contents(:welcome).id, :article => { 'published_at(1i)' => '2005', 'published_at(2i)' => '1', 'published_at(3i)' => '1', 'published_at(4i)' => '10' }
assert_redirected_to :action => 'index'
assert assigns(:article).published?
assert_equal Time.local(2005, 1, 1, 9, 0, 0).utc, assigns(:article).published_at
assert_equal Time.utc(2005, 1, 1, 5, 0, 0), assigns(:article).published_at
end
end

Expand Down Expand Up @@ -330,7 +330,7 @@ def test_should_not_create_article_when_uploading_asset
assert_template 'new'
assert_valid assigns(:article)
assert assigns(:article).new_record?
assert_equal Time.local(2005, 1, 1, 9, 0, 0).utc, assigns(:article).published_at
assert_equal Time.utc(2005, 1, 1, 5, 0, 0), assigns(:article).published_at
assert_equal users(:quentin), assigns(:article).updater
end
end
Expand Down

0 comments on commit 2747e83

Please sign in to comment.