Module: Decidim::Votings::Census::FrontendFields
- Extended by:
- ActiveSupport::Concern
- Included in:
- CheckForm, InPersonForm, LoginForm
- Defined in:
- app/forms/decidim/votings/census/frontend_fields.rb
Overview
Definition of the fields required for frontend forms
Instance Method Summary collapse
Instance Method Details
#birthdate ⇒ Object
34 35 36 37 38 |
# File 'app/forms/decidim/votings/census/frontend_fields.rb', line 34 def birthdate return unless [year, month, day].all? { |part| part.is_a? Numeric } format("%04d%02d%02d", year, month, day) end |
#check_birthdate ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/forms/decidim/votings/census/frontend_fields.rb', line 26 def check_birthdate return unless birthdate errors.add(:birthdate, :invalid) if Date.civil(year, month, day) > Time.zone.today rescue Date::Error errors.add(:birthdate, :invalid) end |