cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

var sToday = new Date(); //today// example : 20.12.2017

this.getView().byId("mesaiTbdPicker").setDateValue(sToday); // set today to datepicker //20.12.2017

and I sending this data.But i looking data in abap date looking 1 before day. //19.12.2017

I tried this but not worked;

var sToday = new Date();

sToday = sToday + 1;

Please help.

0 Likes
View Entire Topic
irfan_gokak
Contributor
0 Likes

Hi,

Before sending date value to the oData you have to format it in format as "YYYY-MM-DDTHH:MM:SS". Use below formatter to do this. Passing date object to the odata cause this issue.

// format date for create
dateFormat:function(value) {
	if(value == null){
		return null;
	}
    	var _smonth = value.getMonth() + 1;
	var _sdate = value.getDate();
	if (_smonth.toString().length < 2) {
		_smonth = "0" + _smonth.toString();
	}
	if (_sdate.toString().length < 2) {
		_sdate = "0" + _sdate.toString();
	}
    	var	formatDate = value.getFullYear()	+ '-' + _smonth + '-' + _sdate + "T00:00:00";
	return formatDate;
},
former_member489109
Participant
0 Likes

Hi Irfan,

I tryed your code but not worked. Check this. (this.dateFormat your format style.) // 21.12.2017 true value

Chek here. One before day. // 20.12.2017 false code.

please help.

irfan_gokak
Contributor
0 Likes

Try this

var sPath = "/MainSet?$filter=Pernr eq '"+this.pernr+"' and 'Tarih eq datetime'"+dDate+"'";
// After this make odata call