Fix for issue #4582, plus simple test

This commit is contained in:
Tony Garnock-Jones 2016-02-26 11:06:03 -05:00
parent d14600152f
commit fa1eb68941
2 changed files with 8 additions and 1 deletions

View File

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

View File

@ -103,6 +103,13 @@ class TestFilters < JekyllUnitTest
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)
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
context "with Date object" do