date filter gracefully accepts empty string

This commit is contained in:
Loren Hale
2015-05-07 17:04:21 +08:00
parent 76c24db039
commit fa6cd6287e
2 changed files with 6 additions and 1 deletions
+4 -1
View File
@@ -310,7 +310,10 @@ module Liquid
def to_date(obj)
return obj if obj.respond_to?(:strftime)
obj = obj.downcase if obj.is_a?(String)
if obj.is_a?(String)
return nil if obj.empty?
obj = obj.downcase
end
case obj
when 'now'.freeze, 'today'.freeze