angularfire2 collection querying with endAt wont give result


angularfire2 collection querying with endAt wont give result



I am trying to querying date range at firebase by using startAt() and endAt() methods.(Angular6)
For date picking i use angular material MatDatepicker module.


q_startDate; q_endDate;
getStartDate(event: MatDatepickerInputEvent<Date>) {
this.q_startDate = event.value.toISOString();}



I defined q_startDate and q_endDate veriables and pushed data with getStartDate and getEndDate methods.


const myCollection = this.afs.collection<objInterface>('collection_name', ref=> {
let query: firestore.CollectionReference | firestore.Query = ref;
query = query.orderBy('date_field', 'desc');
query = query.startAt(this.q_startDate);
query = query.endAt(this.q_endDate);
return query;
});



In this query when i comment query = query.endAt(this.q_endDate); it works.
How can i fix this issue, i want to include query also q_endDate?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Rothschild family

Cinema of Italy