demarches-normaliennes/app/components/editable_champ/datetime_component.rb
2022-09-01 09:48:27 +02:00

13 lines
307 B
Ruby

class EditableChamp::DatetimeComponent < ApplicationComponent
def initialize(form:, champ:)
@form, @champ = form, champ
end
def datetime_start_year(date)
if date == nil || date.year == 0 || date.year >= Date.today.year - 1
Date.today.year - 1
else
date.year
end
end
end