mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Refactor date filter to accept "Time types" other than Date, Time, and DateTime. For example, TzTime (http://github.com/rails/tztime/tree/master) is now supported.
This commit is contained in:
@@ -126,16 +126,13 @@ module Liquid
|
|||||||
return input.to_s
|
return input.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
date = case input
|
date = input.is_a?(String) ? Time.parse(input) : input
|
||||||
when String
|
|
||||||
Time.parse(input)
|
if date.respond_to?(:strftime)
|
||||||
when Date, Time, DateTime
|
date.strftime(format.to_s)
|
||||||
input
|
|
||||||
else
|
else
|
||||||
return input
|
input
|
||||||
end
|
end
|
||||||
|
|
||||||
date.strftime(format.to_s)
|
|
||||||
rescue => e
|
rescue => e
|
||||||
input
|
input
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user