public
Rubygem
Description: Liquid markup language. Save, customer facing template language for flexible web apps.
Homepage: http://www.liquidmarkup.org
Clone URL: git://github.com/tobi/liquid.git
Click here to lend your support to: liquid and make a donation at www.pledgie.com !
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.
zackchandler (author)
Fri Sep 05 11:16:24 -0700 2008
commit  24bf446b0e789865370bfe248c2cfe44602afd61
tree    d53048def67866e50e2efa5a978182866ec62407
parent  7acdac2a1c771c92fb04fd208d11dae5aa7054dc
...
126
127
128
129
130
131
132
133
 
 
 
 
134
135
 
136
137
138
139
140
141
...
126
127
128
 
 
 
 
 
129
130
131
132
133
 
134
135
 
 
136
137
138
0
@@ -126,16 +126,13 @@ module Liquid
0
         return input.to_s
0
       end
0
       
0
-      date = case input
0
-      when String
0
-        Time.parse(input)
0
-      when Date, Time, DateTime
0
-        input
0
+      date = input.is_a?(String) ? Time.parse(input) : input
0
+      
0
+      if date.respond_to?(:strftime)
0
+        date.strftime(format.to_s)
0
       else
0
-        return input
0
+        input
0
       end
0
-              
0
-      date.strftime(format.to_s)
0
     rescue => e 
0
       input
0
     end

Comments