
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
TL;DR
The developer is querying the $createdAt column using a string in the format "YYYY-MM". The solution is to create variables for the start and end of the month using the provided date string. Then, include a query to filter records between these dates using `sdk.Query.between('$createdAt', startOfMonth, endOfMonthISO)`.
const date_time = "2024-11"; const batchs = await databases.listDocuments( process.env.APPWRITE_DATABASE_ID, process.env.APPWRITE_COLLECTION_ID, [ ? ] );

[SOLVED]
TypeScript
const startOfMonth = "${date_time}-01T00:00:00.000Z";
const endOfMonth = new Date("${date_time}-01T00:00:00.000Z");
endOfMonth.setMonth(endOfMonth.getMonth() + 1);
endOfMonth.setDate(0);
const endOfMonthISO = endOfMonth.toISOString();
query.push(sdk.Query.between('$createdAt', startOfMonth, endOfMonthISO));
Recommended threads
- Error getting session: AppwriteException...
I get this error `Error getting session: AppwriteException: User (role: guests) missing scope (account)` when running in prod. As soon as I try running my app o...
- PR Review and Issue Assign?
I am not familiar with how things work here. I know that Issue have to be assigned before solving problem, It is for not wasting contributors time but I like t...
- Need help with clerk auth
Im having issue with auth
