aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/smart_date.coffee7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/assets/javascripts/smart_date.coffee b/app/assets/javascripts/smart_date.coffee
index 901b7a545..d9228670d 100644
--- a/app/assets/javascripts/smart_date.coffee
+++ b/app/assets/javascripts/smart_date.coffee
@@ -4,16 +4,15 @@ smartDateSelectSelector = "#{smartDateSelector} select"
legalDaysPerMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
correctDay = (dateValues) ->
- [day, month, year] = dates
+ [day, month, year] = dateValues
return day if legalDaysPerMonth[month-1] >= day
return 29 if day == 29 && isLeapYear(year)
legalDaysPerMonth[month-1]
smartCorrectDate = ->
allSelectors = $(@).parent().children('select') # N'a pas un sibbling('select', include_self = true) ?
- console.log allSelectors
- allVals = allSelectors.map (sel) -> parseInt($(sel).val())
- console.log allVals
+ allVals = allSelectors.map (index, sel) ->
+ parseInt($(sel).val())
correctedDay = correctDay allVals
daySelector = allSelectors.first()
$(daySelector).val(correctedDay)