export class ResCheck{
descrizioneIntervento: string;
destinazioneDescrizione: string;
fermoLocalita: string;
caricoData: string;
veicoloTarga: string;
destinazione: string;
}
I have this type of array and the caricoData is the value that contains the date that I need to verify.
Basically, what I need to do is a button that, when clicked, is able to search through each option of the array for the element with the latest date in caricoData, and then print it on screen.
let formattedDate = Utilities.toDateTimeString(check[0].caricoData)
Right now, this only get the date of the first element regardless of how late the date is, check[] being the array to check.
All I ask is how can I determine which of the element in the array has the latest date? I thought abotu using a forEach() but I can't seem to make it work in any way.
The date is saved as DD/MM/YYYY