pull a number From the record to the number

Viewed 30

how to pull a number out of day (columns in a day)
the date, but I need to display the records for a day (number)
doesn't help lenght
console.log(day.lenght) -> fake number sends use mysql2

        const day = rows[1].createdAt + moment().startOf("day").toDate()
        const week = rows[0].createdAt + moment().startOf("week").toDate()
        const month = rows[0].createdAt + moment().startOf("month").toDate()
1 Answers

You can use a map function to return an array of dates from the rows array

const day = rows.map(function(row) {
   return row.createdAt + moment().startOf("day").toDate();
});
Related