lib/active_model/form/attributes.rb in activemodel-form-1.0.0 vs lib/active_model/form/attributes.rb in activemodel-form-1.1.0
- old
+ new
@@ -84,9 +84,27 @@
def self.limit
nil
end
end
+ module DateAttribute
+ def self.parse(v)
+ if v.is_a?(String)
+ Date.parse(v)
+ else
+ nil
+ end
+ end
+
+ def self.type
+ :timestamp
+ end
+
+ def self.number?
+ false
+ end
+ end
+
module DateTimeAttribute
def self.parse(v)
if v.compact.present?
DateTime.new(*v)
else