aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets/javascripts/smart_date.coffee
diff options
context:
space:
mode:
authorRobert2017-06-27 19:58:48 +0200
committerRobert2017-06-27 20:11:18 +0200
commit083d23585935139b5e87b99bf5cc2a79f4a53cca (patch)
treed733458dca16e08cece47d915146f8e95126cf6a /app/assets/javascripts/smart_date.coffee
parentdcf8868773491c66c4527fe768ceacef38cf0e16 (diff)
downloadchouette-core-083d23585935139b5e87b99bf5cc2a79f4a53cca.tar.bz2
Refs: #3595@0.5h live event subscription & smart_date class added to all date input elements
Diffstat (limited to 'app/assets/javascripts/smart_date.coffee')
-rw-r--r--app/assets/javascripts/smart_date.coffee8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/assets/javascripts/smart_date.coffee b/app/assets/javascripts/smart_date.coffee
index d9228670d..7ea634a19 100644
--- a/app/assets/javascripts/smart_date.coffee
+++ b/app/assets/javascripts/smart_date.coffee
@@ -1,8 +1,8 @@
-
-smartDateSelector = '.smart_date'
-smartDateSelectSelector = "#{smartDateSelector} select"
legalDaysPerMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+isLeapYear = (year) ->
+ (year % 4 == 0) && ((year % 400 == 0) || (year % 100 != 0))
+
correctDay = (dateValues) ->
[day, month, year] = dateValues
return day if legalDaysPerMonth[month-1] >= day
@@ -18,4 +18,4 @@ smartCorrectDate = ->
$(daySelector).val(correctedDay)
$ ->
- $(smartDateSelectSelector).on 'change', smartCorrectDate
+ $(document).on 'change', '.smart_date select', smartCorrectDate