Sha256: 921f6760707735802884cf08324877f6e05ec2b2d743f0de9adff08f56e3bd9b
Contents?: true
Size: 760 Bytes
Versions: 59
Compression:
Stored size: 760 Bytes
Contents
module ActionView module Helpers module Tags # :nodoc: class DatetimeField < TextField # :nodoc: def render options = @options.stringify_keys options["value"] ||= format_date(value(object)) options["min"] = format_date(datetime_value(options["min"])) options["max"] = format_date(datetime_value(options["max"])) @options = options super end private def format_date(value) value.try(:strftime, "%Y-%m-%dT%T.%L%z") end def datetime_value(value) if value.is_a? String DateTime.parse(value) rescue nil else value end end end end end end
Version data entries
59 entries across 58 versions & 8 rubygems