Firestore timestamp condition does not work

Viewed 34

Timestamp condition does not work in my Firebase firestore. Any help would be greatly appreciated. Here is my code:

static getHistory(uid) {
    let today = moment(),
        past = moment(today).subtract(30, 'days');
    const db = Firebase.firestore();
    return db.collection("user_history")
        .orderBy("creation_date")
        .where("user_id", "==", uid)
        .where("creation_date", "<=", past.toDate())
        .where("creation_date", ">=", today.toDate())        
        .withConverter(UserHistoryConverter)
        .get()
        .then((querySnapshot) => {
            const products = [];
            querySnapshot.forEach((doc) => {
                const data = doc.data();
                if (_.isObject(data))
                    products.push(data);
            });
            return products;
        });
}
0 Answers
Related