| 4.14.7 |
2019-08-22 |
diff --git a/docs/index.html b/docs/index.html
index 3eaa96e..a6f3182 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -168,7 +168,7 @@
systeminformation
- Current Version: 4.14.7
+ Current Version: 4.14.8
diff --git a/lib/util.js b/lib/util.js
index f9d1dab..7f39f58 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -132,7 +132,7 @@ function parseTime(t) {
hour = isPM && hour < 12 ? hour + 12 : hour;
return ('0' + hour).substr(-2) + ':' + ('0' + min).substr(-2);
}
- let parts = t.split('.');
+ parts = t.split('.');
if (parts.length >= 2) {
let isPM = (parts[1] && (parts[1].toLowerCase().indexOf('pm') > -1) || (parts[1].toLowerCase().indexOf('p.m.') > -1) || (parts[1].toLowerCase().indexOf('p. m.') > -1) || (parts[1].toLowerCase().indexOf('n') > -1) || (parts[1].toLowerCase().indexOf('ch') > -1) || (parts[1].toLowerCase().indexOf('ös') > -1));
hour = parseInt(parts[0], 10);
@@ -140,7 +140,7 @@ function parseTime(t) {
hour = isPM && hour < 12 ? hour + 12 : hour;
return ('0' + hour).substr(-2) + ':' + ('0' + min).substr(-2);
}
- let parts = t.split(' ');
+ parts = t.split(' ');
if (parts.length >= 2) {
let isPM = ((t.toLowerCase().indexOf('pm') > -1) || (t.toLowerCase().indexOf('p.m.') > -1) || (t.toLowerCase().indexOf('p. m.') > -1) || (t.toLowerCase().indexOf('n') > -1) || (t.toLowerCase().indexOf('ch') > -1) || (t.toLowerCase().indexOf('ös') > -1));
hour = parseInt(parts[0], 10);
@@ -173,8 +173,14 @@ function parseDateTime(dt) {
result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
} else {
// Dateformat: mm/dd/yyyy or dd/mm/yyyy
- result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2);
-
+ const isEN = ((dt.toLowerCase().indexOf('pm') > -1) || (dt.toLowerCase().indexOf('p.m.') > -1) || (dt.toLowerCase().indexOf('p. m.') > -1) || (dt.toLowerCase().indexOf('am') > -1) || (dt.toLowerCase().indexOf('a.m.') > -1) || (dt.toLowerCase().indexOf('a. m.') > -1));
+ if (isEN) {
+ // Dateformat: mm/dd/yyyy
+ result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2);
+ } else {
+ // Dateformat: dd/mm/yyyy
+ result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2);
+ }
}
}
}
@@ -187,7 +193,6 @@ function parseDateTime(dt) {
}
if (parts[0].indexOf('-') >= 0) {
// Dateformat: yyyy-mm-dd
- const isEN = ((dt.toLowerCase().indexOf('pm') > -1) || (t.toLowerCase().indexOf('p.m.') > -1) || (t.toLowerCase().indexOf('p. m.') > -1) || (dt.toLowerCase().indexOf('am') > -1) || (t.toLowerCase().indexOf('a.m.') > -1) || (t.toLowerCase().indexOf('a. m.') > -1));
const dtparts = parts[0].split('-');
if (dtparts.length === 3) {
result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2);