| 5.24.4 |
2025-01-02 |
diff --git a/docs/index.html b/docs/index.html
index 94fa8a8..1969bec 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -170,7 +170,7 @@
systeminformation
- 3New Version: 5.24.4
+ 3New Version: 5.24.5
diff --git a/lib/users.js b/lib/users.js
index e6ffc3b..960f438 100644
--- a/lib/users.js
+++ b/lib/users.js
@@ -105,10 +105,18 @@ function parseUsersDarwin(lines) {
// who part
if (is_whopart) {
+ let dt = ('' + new Date().getFullYear()) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
+ try {
+ if (new Date(dt) > new Date) {
+ dt = ('' + (new Date().getFullYear() - 1)) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2);
+ }
+ } catch {
+ util.noop();
+ }
result_who.push({
user: l[0],
tty: l[1],
- date: ('' + new Date().getFullYear()) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2),
+ date: dt,
time: l[4],
});
} else {
@@ -146,7 +154,7 @@ function users(callback) {
// linux
if (_linux) {
- exec('who --ips; echo "---"; w | tail -n +2', function (error, stdout) {
+ exec('export LC_ALL=C; who --ips; echo "---"; w; unset LC_ALL | tail -n +2', function (error, stdout) {
if (!error) {
// lines / split
let lines = stdout.toString().split('\n');
@@ -195,7 +203,7 @@ function users(callback) {
}
if (_darwin) {
- exec('who; echo "---"; w -ih', function (error, stdout) {
+ exec('export LC_ALL=C; who; echo "---"; w -ih; unset LC_ALL', function (error, stdout) {
if (!error) {
// lines / split
let lines = stdout.toString().split('\n');