diff --git a/lib/liquid/utils.rb b/lib/liquid/utils.rb index 7725ff87..4e18138b 100644 --- a/lib/liquid/utils.rb +++ b/lib/liquid/utils.rb @@ -72,7 +72,7 @@ module Liquid when String Time.parse(obj) end - rescue ArgumentError + rescue ::ArgumentError nil end end diff --git a/test/integration/standard_filter_test.rb b/test/integration/standard_filter_test.rb index df397c40..ac9a5325 100644 --- a/test/integration/standard_filter_test.rb +++ b/test/integration/standard_filter_test.rb @@ -420,6 +420,11 @@ class StandardFiltersTest < Minitest::Test assert_template_result('a', "{{ 'a' | to_number }}") end + def test_date_raises_nothing + assert_template_result('', "{{ '' | date: '%D' }}") + assert_template_result('abc', "{{ 'abc' | date: '%D' }}") + end + private def with_timezone(tz)