Try2prog
Try2prog

Reputation: 191

React Native Timestamp query (firestore) not giving the right result

I have an query sorting by timestamp, and I need to see only the data within last week

so I did .dbRef .where('regTime', '>', new Date( -7 * 24 * 60 * 60 * 1000)

but somehow not filtered by correct results.

anyone knows why?

Upvotes: 0

Views: 106

Answers (1)

Try2prog
Try2prog

Reputation: 191

seem to be less interesting / active programmers or people who like to help in react native, so for future searchers:

let weekAgo = new Date();
let weekInMilliseconds = -7 * 24 * 60 * 60 * 1000;
weekAgo.setTime(weekAgo.getTime() + weekInMilliseconds); 

Upvotes: 1

Related Questions