From 44e33eb2de2f9c9672b4b8e8804728dfa6fff5ab Mon Sep 17 00:00:00 2001 From: MichiK <6341204+der-michik@users.noreply.github.com> Date: Thu, 6 Dec 2018 22:45:40 +0100 Subject: [PATCH] Some small JS fixes for eslint compliance --- resources/assets/js/forms.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/forms.js b/resources/assets/js/forms.js index 3f2014d0..24f94cf3 100644 --- a/resources/assets/js/forms.js +++ b/resources/assets/js/forms.js @@ -1,3 +1,5 @@ +const moment = require('moment'); + /** * Sets all checkboxes to the wanted state * @@ -116,7 +118,7 @@ $(function () { elem.children('input').attr('type', 'text'); elem.children().on('click', function (ev) { ev.stopImmediatePropagation(); - if (elem.data('DateTimePicker') === undefined) { + if (typeof elem.data('DateTimePicker') === "undefined") { elem.datetimepicker(opts); elem.data('DateTimePicker').show(); } else { @@ -156,11 +158,11 @@ $(function () { elem.find('button').on('click', function () { var input = elem.children('input').first(); input.val(moment().format('HH:mm')); - var day_selector = $('#' + input.attr('id').replace('time', 'day')); - var days = day_selector.children('option'); + var daySelector = $('#' + input.attr('id').replace('time', 'day')); + var days = daySelector.children('option'); days.each(function (i) { if ($(days[i]).val() === moment().format('YYYY-MM-DD')) { - day_selector.val($(days[i]).val()); + daySelector.val($(days[i]).val()); return false; } });