Merge pull request #4590 from tonyg/pr4582

Merge pull request 4590
This commit is contained in:
jekyllbot 2016-02-29 16:12:06 -08:00
commit c16a2f4d6a
2 changed files with 8 additions and 1 deletions

View File

@ -315,7 +315,7 @@ module Jekyll
def time(input) def time(input)
case input case input
when Time when Time
input input.clone
when Date when Date
input.to_time input.to_time
when String when String

View File

@ -103,6 +103,13 @@ class TestFilters < JekyllUnitTest
should "format a time according to RFC-822" do should "format a time according to RFC-822" do
assert_equal "Wed, 27 Mar 2013 11:22:33 +0000", @filter.date_to_rfc822(@sample_time) assert_equal "Wed, 27 Mar 2013 11:22:33 +0000", @filter.date_to_rfc822(@sample_time)
end end
should "not modify a time in-place when using filters" do
t = Time.new(2004, 9, 15, 0, 2, 37, "+01:00")
assert_equal 3600, t.utc_offset
@filter.date_to_string(t)
assert_equal 3600, t.utc_offset
end
end end
context "with Date object" do context "with Date object" do