Removed timezone adjustments from date parsing. It doesn't make sense to adjust a date, only a time. Thanks to the commenters on ticket #427.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@444 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-02-17 07:03:56 +00:00
parent b7dc28842f
commit 48e9bcc33f
2 changed files with 2 additions and 8 deletions

View file

@ -108,13 +108,7 @@ class ApplicationController < ActionController::Base
def parse_date_per_user_prefs( s ) def parse_date_per_user_prefs( s )
return nil if s.blank? return nil if s.blank?
#logger.info "Unadjusting user date #{s} from #{@user.prefs.tz} parsing with #{@user.prefs.date_format}" Date.strptime(s, @user.prefs.date_format)
time = Date.strptime(s, @user.prefs.date_format)
#logger.info "parsed = #{time}"
unadjusted = @user.prefs.tz.unadjust(time).utc
#logger.info "unadjusted = #{unadjusted}"
#logger.info "returning #{unadjusted.to_date}"
unadjusted.to_date
end end
def init_data_for_sidebar def init_data_for_sidebar

View file

@ -101,7 +101,7 @@ class TodosControllerTest < Test::Unit::TestCase
t = Todo.find(1) t = Todo.find(1)
assert_equal "Call Warren Buffet to find out how much he makes per day", t.description assert_equal "Call Warren Buffet to find out how much he makes per day", t.description
assert_equal "foo, bar", t.tag_list assert_equal "foo, bar", t.tag_list
expected = Date.new(2006,11,30).to_time.utc.to_date expected = Date.new(2006,11,30)
actual = t.due actual = t.due
assert_equal expected, actual, "Expected #{expected.to_s(:db)}, was #{actual.to_s(:db)}" assert_equal expected, actual, "Expected #{expected.to_s(:db)}, was #{actual.to_s(:db)}"
end end