Hello, I want to get a list of Document by Query.between using date.
String today = DateTime.now().toString().substring(0, 10); // YYYY-MM-DD
String oneMonthAgo = DateTime.now().subtract(Duration(days: 30)).toString().substring(0, 10);
...
dataMonth = database.listDocuments(
databaseId: databaseId,
collectionId: collectionId,
queries: [
Query.between(
'\$createdAt',
oneMonthAgo,
today),
]
...
context.log("Documents");
dataMonth.documents.every(
(element) {
context.log(element.data['data']);
return true;
},
);
// Printed 1 document, expected 3 documents
There are 3 documents with the same CreatedAt date, but only one of them is returned. Is there anything I did wrong?
Reason: different timezone, about 6 hours before the server fix: add a whole day to DateTime today
String today = DateTime.now().add(Duration(days: 1)).toString().substring(0, 10);
String oneMonthAgo = DateTime.now().subtract(Duration(days: 31)).toString().substring(0, 10);
[SOLVED] Use Query.between() to list documents by date
Recommended threads
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...
- Flutter Android oAuth is no more working
I currently don't get the oAuth login to work in flutter android. it works on ios and on web. but when try to use it on Android, i get to the point where the ca...
- Function domain not available
Hello, even tho in docs you clearly describe that every function has its domain, I can not see it anywhere in any of my projects. How do I reveal the url of th...