I need to compare a timestamp field with the current date in javascript.
I tryed like this:
let myDocs = [];
await getDocs( collection( database, 'myCollection' ) ).then( ( documents ) => {
documents.docs.forEach( ( document ) => {
if(document.data().createdAt < new Date() ){
myDocs.push({ id:document.id, ...document.data() });
}
});
});
Via Active questions tagged javascript - Stack Overflow https://ift.tt/ZfglBbw
Comments
Post a Comment