From c5711c095f4269038b411dc960280e4f5981609f Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Thu, 13 Mar 2025 17:36:29 -0400 Subject: [PATCH] Improve docs of `date` filter (#1920) --- lib/liquid/standardfilters.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/liquid/standardfilters.rb b/lib/liquid/standardfilters.rb index 08361a46..618cd71b 100644 --- a/lib/liquid/standardfilters.rb +++ b/lib/liquid/standardfilters.rb @@ -712,7 +712,16 @@ module Liquid input.gsub(/\r?\n/, "
\n") end - # Reformat a date using Ruby's core Time#strftime( string ) -> string + # @liquid_public_docs + # @liquid_type filter + # @liquid_category date + # @liquid_summary + # Formats a date according to a specified format string. + # @liquid_description + # This filter formats a date using various format specifiers. If the format string is empty, + # the original input is returned. If the input cannot be converted to a date, the original input is returned. + # + # The following format specifiers can be used: # # %a - The abbreviated weekday name (``Sun'') # %A - The full weekday name (``Sunday'') @@ -741,8 +750,8 @@ module Liquid # %Y - Year with century # %Z - Time zone name # %% - Literal ``%'' character - # - # See also: http://www.ruby-doc.org/core/Time.html#method-i-strftime + # @liquid_syntax date | date: string + # @liquid_return [string] def date(input, format) str_format = Utils.to_s(format) return input if str_format.empty?