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
- Appwrite-injected variables are not avai...
I am using rust-1.83 as a runtime and try to access APPWRITE_FUNCTION_API_ENDPOINT or APPWRITE_FUNCTION_API_KEY during runtime. Both are not set during my execu...
- Appwrite (Dart SDK) (for package_info_pl...
Hi team! Many Flutter plugins now need package_info_plus 10.x and device_info_plus 13.x, but appwrite 25.4.0 still constrains package_info_plus: >=8.0.2 <10.0...
- Functions in cloud console not works
please advise as all of my runing functions on Appwrite console was working before , but now it give this error [Invalid `headers` param: Value must be a valid...