blob: a1265d99284d9187bf908f65b0db73c366cb6372 (
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 WeekField < TextField #:nodoc:
def render
options = @options.stringify_keys
options["value"] = @options.fetch("value") { format_week_string(value(object)) }
options["min"] = format_week_string(options["min"])
options["max"] = format_week_string(options["max"])
@options = options
super
end
private
def format_week_string(value)
value.try(:strftime, "%Y-W%W")
end
end
end
end
end
|