blob: 11d58744fdcecac19fab8cdb0dcbf2e9610c0b5e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module ActionView
module Helpers
module Tags
class DatetimeField < TextField #:nodoc:
def render
options = @options.stringify_keys
options["value"] = @options.fetch("value") { format_global_date_time_string(value(object)) }
options["min"] = format_global_date_time_string(options["min"])
options["max"] = format_global_date_time_string(options["max"])
@options = options
super
end
private
def format_global_date_time_string(value)
value.try(:strftime, "%Y-%m-%dT%T.%L%z")
end
end
end
end
end
|