mirror of
https://github.com/kemko/liquid.git
synced 2026-01-04 17:25:41 +03:00
Added tests to verify that {{ 'now' | date :'%Y' }} and {{ 'today' | date :'%Y' }} work.
In the case of Ruby 1.9.3, 'now' is no longer parsed. For safe measures, I've added 'today' as well.
This commit is contained in:
@@ -169,7 +169,16 @@ module Liquid
|
||||
input = Time.at(input.to_i)
|
||||
end
|
||||
|
||||
date = input.is_a?(String) ? Time.parse(input) : input
|
||||
date =
|
||||
if input.is_a?(String)
|
||||
case input.downcase
|
||||
when 'now', 'today' then Time.now
|
||||
else
|
||||
Time.parse(input)
|
||||
end
|
||||
else
|
||||
input
|
||||
end
|
||||
|
||||
if date.respond_to?(:strftime)
|
||||
date.strftime(format.to_s)
|
||||
|
||||
Reference in New Issue
Block a user