@osimatic/helpers-js 1.1.21 → 1.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/date_time.js +4 -0
- package/form_helper.js +10 -4
- package/package.json +1 -1
package/date_time.js
CHANGED
|
@@ -244,10 +244,12 @@ class DateTime {
|
|
|
244
244
|
jsDate.setHours(0);
|
|
245
245
|
jsDate.setMinutes(0);
|
|
246
246
|
jsDate.setSeconds(0);
|
|
247
|
+
jsDate.setMilliseconds(0);
|
|
247
248
|
let today = new Date();
|
|
248
249
|
today.setHours(0);
|
|
249
250
|
today.setMinutes(0);
|
|
250
251
|
today.setSeconds(0);
|
|
252
|
+
today.setMilliseconds(0);
|
|
251
253
|
return jsDate.getTime() < today.getTime();
|
|
252
254
|
}
|
|
253
255
|
|
|
@@ -255,10 +257,12 @@ class DateTime {
|
|
|
255
257
|
jsDate.setHours(0);
|
|
256
258
|
jsDate.setMinutes(0);
|
|
257
259
|
jsDate.setSeconds(0);
|
|
260
|
+
jsDate.setMilliseconds(0);
|
|
258
261
|
let today = new Date();
|
|
259
262
|
today.setHours(0);
|
|
260
263
|
today.setMinutes(0);
|
|
261
264
|
today.setSeconds(0);
|
|
265
|
+
today.setMilliseconds(0);
|
|
262
266
|
return jsDate.getTime() > today.getTime();
|
|
263
267
|
}
|
|
264
268
|
|
package/form_helper.js
CHANGED
|
@@ -101,20 +101,26 @@ class FormHelper {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
static setOnInputChange(input, callback, doneTypingInterval) {
|
|
104
|
-
//setup before functions
|
|
105
|
-
let typingTimer;
|
|
104
|
+
// setup before functions
|
|
105
|
+
let typingTimer; // timer identifier
|
|
106
106
|
doneTypingInterval = typeof doneTypingInterval != 'undefined' && null !== doneTypingInterval ? doneTypingInterval : 700; // time in ms
|
|
107
107
|
|
|
108
|
-
//on keyup, start the countdown
|
|
108
|
+
// on keyup, start the countdown
|
|
109
109
|
input.on('keyup', function () {
|
|
110
110
|
clearTimeout(typingTimer);
|
|
111
111
|
typingTimer = setTimeout(callback, doneTypingInterval);
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
//on keydown, clear the countdown
|
|
114
|
+
// on keydown, clear the countdown
|
|
115
115
|
input.on('keydown', function () {
|
|
116
116
|
clearTimeout(typingTimer);
|
|
117
117
|
});
|
|
118
|
+
|
|
119
|
+
// on focusout, clear the countdown and call callback
|
|
120
|
+
input.on('focusout', function () {
|
|
121
|
+
clearTimeout(typingTimer);
|
|
122
|
+
callback();
|
|
123
|
+
});
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
// ------------------------------------------------------------
|