Page 1 of 1

Writing The Datepicker Value Change Javascript For "where" In Mapping To Search Section Of Database

Posted: Mon Apr 21, 2014 4:51 pm
by Anthony Corsi

Here is a screenshot of where I need to add the Javascript code:

Image

The problem is that I don't know which code to add so that when a date is selected, it will show the "Day" colomn of the database I created. (Note: not all the entries just the one corresponding to that specific date.)

Here is a screenshot of the database:

Image

I tried adding this code, but it still didn't work:

return '{"Days":"'+value+'"}';


Writing The Datepicker Value Change Javascript For "where" In Mapping To Search Section Of Database

Posted: Mon Apr 21, 2014 10:21 pm
by Illya Stepanov

Hi Anthony,

Please check this topics, hopefully they help:
:: https://getsatisfaction.com/apperyio/...
:: https://getsatisfaction.com/apperyio/...


Writing The Datepicker Value Change Javascript For "where" In Mapping To Search Section Of Database

Posted: Sun Sep 14, 2014 5:18 pm
by Anthony Corsi

I looked at both and it still doesn't work. Any suggestions?


Writing The Datepicker Value Change Javascript For "where" In Mapping To Search Section Of Database

Posted: Sun Sep 14, 2014 5:44 pm
by Illya Stepanov

Hi Anthony,

Could you clarify what have you tried and what exactly does not work?


Writing The Datepicker Value Change Javascript For "where" In Mapping To Search Section Of Database

Posted: Wed Oct 29, 2014 12:48 pm
by Anthony Corsi

I have tried both links you have provided and both were unsuccessful to help me solve this problem


Writing The Datepicker Value Change Javascript For "where" In Mapping To Search Section Of Database

Posted: Thu Oct 30, 2014 2:06 am
by Yurii Orishchuk

Hi Anthony,

Here is tested code for your goals:

pre

var d1 = new Date(value);

var timeOffset = d1.getTimezoneOffset() / (-60);
var localDate = new Date(d1.getTime() + timeOffset * 3600 * 1000);

var dateText = localDate.toISOString().replace(/T.*/gi, "") + "T00:00:00.000Z";

//Note: "date" is your field by which you want to filter items.
var whereObject = {"date": dateText};

return JSON.stringify(whereObject);

/pre

Details: http://prntscr.com/515igd/direct

Regards.