From 005d910624bbfa724b638426a000c8074d4201a2 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sat, 1 Dec 2012 11:15:29 +0000 Subject: Make `Time.zone.parse` to work with JavaScript date strings Chrome, Safari and Firefox serialize Date objects to strings such as 'Mon May 28 2012 00:00:00 GMT-0700 (PDT)'. When these strings are parsed the zone is interpreted as 'GMT-0700' which doesn't exist in the TzInfo list of timezones. By taking advantage of the improved date/time handling in 1.9.3 we can use `Date._parse` and the `:offset` value which is parsed correctly. Three tests were amended to make them pass: 1. test_parse_with_old_date This needed changing to a different value because the original value was before EST was adopted so was being changed to a LMT (Local Mean Time) value after the change. It didn't before because `DateTime` just has offsets from UTC not timezones. 2. test_parse_should_not_black_out_system_timezone_dst_jump Changed the implementation of this test as the stubs were dependent on internal implementation details of the test. Confirmed that the modified test still failed when the implementation of `parse` was restored to pre-#5571. 3. test_parse_should_black_out_app_timezone_dst_jump Ditto. Closes #5770. --- activesupport/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activesupport/CHANGELOG.md') diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 1744d48c4b..12d81436ff 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,5 +1,7 @@ ## Rails 4.0.0 (unreleased) ## +* Make `Time.zone.parse` to work with JavaScript format date strings. *Andrew White* + * Add `DateTime#seconds_until_end_of_day` and `Time#seconds_until_end_of_day` as a complement for `seconds_from_midnight`; useful when setting expiration times for caches, e.g.: -- cgit v1.2.3