i have these two "where" and if I'll add the "where" for the date, it's not working anymore. I just watn to show all of the orders with the order status of confirmed and a delivery date of today.
var start = new Date();
start.setUTCHours(0, 0, 0, 0);
var startOfDay = start.toLocaleDateString();
console.log(startOfDay);
var end = new Date();
end.setHours(23, 59, 59, 999);
var endOfDay = end.toUTCString();
console.log(endOfDay);
try {
firestore
.collection("orders")
.where("orderStatus", "==", "Confirmed")
.where("deliveryDate", ">=", startOfDay)
.where("deliveryDate", "<=", endOfDay)
.onSnapshot((snapshot) => {
const orders = [];
snapshot.docs.map((doc) => {
const data = doc.data();
orders.push({
"Order ID": doc.id,
});
});
console.log(orders);
this.setState({ orders: orders });
console.log(this.state.orders);
});
} catch (err) {
console.log(err);
}
}