From 0e909cd3078bab352eb741426024334afe0d6820 Mon Sep 17 00:00:00 2001 From: Ulysse Carion Date: Wed, 7 May 2014 09:12:25 -0700 Subject: Make TimeZone#parse behave more like Time#parse. Namely, if the mday is omitted but any other upper components are, then instead of supplying the mday from the current time, it defaults to 1. --- activesupport/test/time_zone_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index 79ec57af2b..37276b71e1 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -254,6 +254,13 @@ class TimeZoneTest < ActiveSupport::TestCase assert_equal Time.utc(1999,12,31,19), twz.time end + def test_parse_with_day_omitted + zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)'] + zone.stubs(:now).returns zone.local(1999, 12, 31) + twz = zone.parse('Feb') + assert_equal Time.utc(1999, 2, 1), twz.time + end + def test_parse_should_not_black_out_system_timezone_dst_jump with_env_tz('EET') do zone = ActiveSupport::TimeZone['Pacific Time (US & Canada)'] -- cgit v1.2.3