4b0e6ea382
* Convert datetime field to datetime_local * Fix tests * Add value formatting view datetime component * Add helper datetime component value
10 lines
354 B
Ruby
10 lines
354 B
Ruby
class EditableChamp::DatetimeComponent < EditableChamp::EditableChampBaseComponent
|
|
def formatted_value_for_datetime_locale
|
|
if @champ.valid? && @champ.value.present?
|
|
# convert to a format that the datetime-local input can understand
|
|
DateTime.iso8601(@champ.value).strftime('%Y-%m-%dT%H:%M')
|
|
else
|
|
@champ.value
|
|
end
|
|
end
|
|
end
|