summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--resources/assets/js/forms.js10
1 files 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;
}
});