Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sammo1235 committed Oct 17, 2024
1 parent 04dc38e commit f89e767
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/assets/javascripts/frontend/form-validation.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,9 @@ window.FormValidation =
questionDay = question.find(".js-date-input-day").val()
questionDate = "#{questionDay}/#{questionMonth}/#{questionYear}"

questionYearTouched = !!question.find('.js-date-input-year.dirty').length
questionMonthTouched = !!question.find(".js-date-input-month.dirty").length
questionDayTouched = !!question.find(".js-date-input-day.dirty").length
allTouched = questionYearTouched && questionMonthTouched && questionDayTouched
[yearTouched, monthTouched, dayTouched] = ['.js-date-input-year', '.js-date-input-month', '.js-date-input-day'].map (cls) ->
!!question.find("#{cls}.dirty").length
allTouched = yearTouched and monthTouched and dayTouched

if not val
return
Expand Down

0 comments on commit f89e767

Please sign in to comment.