2022-09-08 11:25:39 +02:00
|
|
|
class EditableChamp::DatetimeComponent < EditableChamp::EditableChampBaseComponent
|
2023-02-09 15:18:38 +01:00
|
|
|
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')
|
2022-08-12 10:45:04 +02:00
|
|
|
else
|
2023-02-09 15:18:38 +01:00
|
|
|
@champ.value
|
2022-08-12 10:45:04 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|