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
- 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...
- Production down - createExecution return...
Hey, Since 1.9.6 rollout in fra (~17:00 UTC, 14 Aug), POST /v1/functions/{functionId}/executions returns a 400 whenever the body includes an empty headers ob...
- CreateRow is doing ListRows on self-host...
### setup ``` appwrite 1.9.5 self-hosted bun 1.3 node-appwrite 27.1.0 ``` ### issue Im running a function on a self hosted 1.9.5 with "node-appwrite": "^27.1.0...