Back

[CLOSED] Any solutions for Query.between() with datetime

  • 0
  • Databases
  • Web
xue
26 Sep, 2023, 16:58
TypeScript
const minDate = new Date();
minDate.setFullYear(minDate.getFullYear() - filterData?.maxAge);
const maxDate = new Date();
maxDate.setFullYear(maxDate.getFullYear() - filterData?.minAge);

Query.between("birthdate", minDate.toDateString(), maxDate.toDateString())
// Query.between("birthdate", minDate, maxDate)
TypeScript
AppwriteException: Invalid query: Query type does not match expected: datetime

Query.between only accept number or string Query.between: (attribute: string, start: string | number, end: string | number) => string

How can i handle with this kind of situations if i want to get docs between 2 dates? Any idea?

TL;DR
Title: [CLOSED] Solutions for Query.between() with datetime I want to use Query.between() with datetime, but it only accepts number and string. I tried to use it with datetime and got an error "AppwriteException: Invalid query: Query type does not match expected: datetime". Known issue: <https://github.com/appwrite/appwrite/issues/5650> Here is the code snippet I tried: ```typescript const minDate = new Date(); minDate.setFullYear(minDate.getFullYear() - filterData?.maxAge); const maxDate = new Date(); maxDate.setFullYear(maxDate.getFullYear() - filterData
Drake
27 Sep, 2023, 01:01
xue
27 Sep, 2023, 08:14

This issue for only the type of float I also commented on related issue with the datetime .Thanks

xue
27 Sep, 2023, 08:20

[CLOSED] Any solutions for Query.between() with datetime

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more