users() fix date time parsing

This commit is contained in:
Sebastian Hildebrandt 2026-01-06 08:35:20 +01:00
parent c87c944cac
commit fe2035b61e

View File

@ -62,12 +62,13 @@ function parseUsersLinux(lines, phase) {
result_who = []; result_who = [];
} }
if (!is_whoerror) { if (!is_whoerror) {
const timePos = l && l.length > 4 && l[4].indexOf(':') > 0 ? 4 : 3;
result_who.push({ result_who.push({
user: l[0], user: l[0],
tty: l[1], tty: l[1],
date: parseDate(l[2], l[3]), date: timePos === 4 ? parseDate(l[2], l[3]) : l[2],
time: l[4], time: l[timePos],
ip: l && l.length > 4 + 1 ? l[4 + 1].replace(/\(/g, '').replace(/\)/g, '') : '' ip: l && l.length > timePos + 1 ? l[timePos + 1].replace(/\(/g, '').replace(/\)/g, '') : ''
}); });
} }
} else { } else {