@akc42/app-utils 5.0.14 → 5.0.16
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-utils.js +3 -3
- package/debug-utils.js +1 -1
- package/package.json +1 -1
package/date-utils.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
const timeRegex = /^((?:0?[0-9]|1[0-9]|2[0-3]))(?::((?:0?[0-9]|[1-5][0-9])))?$/;
|
|
21
21
|
export function minToTime(m) {
|
|
22
22
|
if (m === 0) return '00:00';
|
|
23
|
-
if (isNaN(m) || m < 0 || m > 1439) return
|
|
23
|
+
if (isNaN(m) || m < 0 || m > 1439) return false;
|
|
24
24
|
|
|
25
25
|
var hr = Math.floor(m/60);
|
|
26
26
|
var mn = Math.floor(m % 60);
|
|
@@ -28,7 +28,7 @@ export function minToTime(m) {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export function timeToMin(time) {
|
|
31
|
-
if (typeof time !== 'string') return
|
|
31
|
+
if (typeof time !== 'string') return 0; //protective against crashes
|
|
32
32
|
if (time.length === 0) return -1;
|
|
33
33
|
const matches = timeRegex.exec(time);
|
|
34
34
|
if (matches) {
|
|
@@ -37,7 +37,7 @@ export function timeToMin(time) {
|
|
|
37
37
|
let hours = parseInt(matches[1], 10);
|
|
38
38
|
if (Number.isInteger(hours) && Number.isInteger(mins)) return (hours * 60) + mins;
|
|
39
39
|
}
|
|
40
|
-
return
|
|
40
|
+
return 0;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
const urlRegex = /^((?:19|2[01])(?:(?:(?:0[48]|[2468][048]|[13579][26])(?=-02-29))|\d{2}(?!-02-(?:29|3[01]))))-((?:02(?!-3[01])|0[469](?!-31)|11(?!-31)|(?:0[13578]|1[02])))-([0][1-9]|[12][0-9]|3[01])$/;
|
package/debug-utils.js
CHANGED
|
@@ -103,7 +103,7 @@ export function DebugHelper(topic, colourspec, shortdate, immediate, writer) {
|
|
|
103
103
|
|
|
104
104
|
const fromDate = new Date(); //logtime is only possible if later than midnight last night.
|
|
105
105
|
const from = fromDate.setHours(0,0,0,0)
|
|
106
|
-
if (!(Number.isInteger(logtime) && logtime > from
|
|
106
|
+
if (!(Number.isInteger(logtime) && logtime > from)) {
|
|
107
107
|
if (ip !== undefined) {
|
|
108
108
|
if (Array.isArray(ip)) args = ip.concat(args); else args.unshift(ip);
|
|
109
109
|
}
|