Anthony Corsi
Posts: 0
Joined: Mon Apr 21, 2014 4:51 pm

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

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+'"}';

Anthony Corsi
Posts: 0
Joined: Mon Apr 21, 2014 4:51 pm

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

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

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

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

Hi Anthony,

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

Anthony Corsi
Posts: 0
Joined: Mon Apr 21, 2014 4:51 pm

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

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

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

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.

Return to “Issues”