diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-06-20 06:23:48 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2019-06-20 06:23:48 +0000 |
commit | 001853ef7951b866089015a7d22e07c787e541a8 (patch) | |
tree | f42101bec9faa24cafe1e393b389827f593cd22b /test/unit/user_test.rb | |
parent | 87e82b4894671b222656c93f5255471747267340 (diff) | |
download | redmine-001853ef7951b866089015a7d22e07c787e541a8.tar.gz redmine-001853ef7951b866089015a7d22e07c787e541a8.zip |
Groups are incorrect when grouping by date without user timezone set.
git-svn-id: http://svn.redmine.org/redmine/trunk@18264 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/user_test.rb')
-rw-r--r-- | test/unit/user_test.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 04e20e9c4..e03528809 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -586,7 +586,23 @@ class UserTest < ActiveSupport::TestCase assert_equal '2012-05-15', User.find(1).time_to_date(time).to_s preference.update_attribute :time_zone, '' - assert_equal '2012-05-15', User.find(1).time_to_date(time).to_s + assert_equal time.localtime.to_date.to_s, User.find(1).time_to_date(time).to_s + end + + def test_convert_time_to_user_timezone_should_return_the_time_according_to_user_time_zone + preference = User.find(1).pref + time = Time.gm(2012, 05, 15, 23, 30).utc # 2012-05-15 23:30 UTC + time_not_utc = Time.new(2012, 05, 15, 23, 30) + + preference.update_attribute :time_zone, 'Baku' # UTC+5 + assert_equal '2012-05-16 04:30:00 +0500', User.find(1).convert_time_to_user_timezone(time).to_s + + preference.update_attribute :time_zone, 'La Paz' # UTC-4 + assert_equal '2012-05-15 19:30:00 -0400', User.find(1).convert_time_to_user_timezone(time).to_s + + preference.update_attribute :time_zone, '' + assert_equal time.localtime.to_s, User.find(1).convert_time_to_user_timezone(time).to_s + assert_equal time_not_utc, User.find(1).convert_time_to_user_timezone(time_not_utc) end def test_fields_for_order_statement_should_return_fields_according_user_format_setting |