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