Caleb Kirby
Posts: 0
Joined: Thu Mar 20, 2014 10:59 am

Where Date is greater than today

I'm trying to build into my query to only return events greater than today's date. Obviously today is dynamic

If I hard code the date it works
{"Event_date":{"$gt":'2014-03-20'}}

but I don't know how to get it to work dynamically

this does not work
{"Event_date":{"$gt":$.datepicker("setDate", "0")}}

Image

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

Where Date is greater than today

Hello,

It should be helpful:

https://getsatisfaction.com/apperyio/...

Caleb Kirby
Posts: 0
Joined: Thu Mar 20, 2014 10:59 am

Where Date is greater than today

Hi Nikita,

I tried with the below in the 'where' part of the query but had no luck

var d = new Date();
d.setDate(d.getDate() + 0);
var dateStr = d.toISOString();
return '{"EventStartDate":{"$gte":"'+ dateStr +'"}}';

I'm not sure if I'm even headed in the right direction here and would appreciate some more assistance.

thanks

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Where Date is greater than today

Hi,

Lets see if this code help:

pre
code
var d = new Date();
d.setDate(d.getDate());
var dateStr = d.toISOString();
return '{"_createdAt":{"$gte":{"$date":"'+ dateStr +'"}}}';
/code
/pre

You can check service request/response is correct in browser console network tab.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Where Date is greater than today

Could you post app publick link?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Where Date is greater than today

Could you also tell us the steps how to reproduce this?

Caleb Kirby
Posts: 0
Joined: Thu Mar 20, 2014 10:59 am

Where Date is greater than today

Sorry, from landing screen - upcoming events - search with QLD as the selected option. It should then give back a list and exclude any before today

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Where Date is greater than today

Where did you add this code?

You should add it on your datasource-request tab-where clause-add JS.

http://docs.appery.io/documentation/r...

Caleb Kirby
Posts: 0
Joined: Thu Mar 20, 2014 10:59 am

Where Date is greater than today

Sorry I had added it into the wrong place.

i have placed it there now and this is the message under the console

Failed to load resource: the server responded with a status of 400 (Bad Request) https://api.appery.io/rest/1/db/colle...

Return to “Issues”