Having Trouble Querying Using Datetime #591
Replies: 1 comment
-
This should be a duplicate of #474. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In Firebase, we have values in the format shown in the image below:
I am using the following function to retrieve dates:
public GetAllCheckInUser(filterData): any {
var date = moment(new Date()).subtract(1, 'h').toDate();
console.log('date',date);
return from(FirebaseFirestore.getCollection({
reference: 'LoggedinUser',
compositeFilter: {
type: 'and',
queryConstraints: [
{
type: 'where',
fieldPath: 'LoggedinAt',
opStr: '>',
value: date,
},
],
},
}))
.pipe(
map((actions) => actions.snapshots.map(a => {
const data = a.data as any;
const id = a.id;
return { id, ...data };
})),
map((data: any) => {
return _.filter(data, (item) => item.AccountNumber !== null);
})
);
}
However, it's not working correctly. We used Firebase Firestore collection query referred from
https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/firestore
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions