Ad Widget

Collapse

Sort an Array vertically via preprocessing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DubiousDev
    Junior Member
    • Jan 2023
    • 1

    #1

    Sort an Array vertically via preprocessing

    Good Afternoon

    We're monitoring a server retrieving a list of users' last logins via HTTP, and the result we get is an array of dates in unixtime, and we send these values into an array and transform them into a normal date. However, the list shows the dates horizontally and we want to organize the values vertically. Is there a way to bring these values into a vertical order? This is what I have so far from the JS preprocessing script:

    HTML Code:
    var dates = value.replace(/, +/g, ",").split(",").map(Number);
    dates.forEach(function(item, index, array) {
    const item = item * 1000;
    const dateObject = new Date(item);
    array[index] = dateObject.toLocaleString();
    })
    return(dates)
    TIA
Working...