Closed tecnodev closed 3 years ago
I'm fetching emails by offset. the results not ordered in DateTime. i tried sort()but it throws "Sort() not a function" .here my code
sort()
Sort() not a function
var searchCriteria = [`${from}:${to}`]; var fetchOptions = { bodies: [""], markSeen: false }; let results = await connection.sort(['-ARRIVAL'] searchCriteria, fetchOptions );
You can try this const searchCriteria = [`${flags}`, ["SINCE", `${from}`], ["BEFORE", `${to}`],["SUBJECT",`${subject}`]]
const searchCriteria = [`${flags}`, ["SINCE", `${from}`], ["BEFORE", `${to}`],["SUBJECT",`${subject}`]]
Or, you can parse your emails into structured data in an array, then sort them yourself.
I'm fetching emails by offset. the results not ordered in DateTime. i tried
sort()
but it throws "Sort() not a function
" .here my code