Skip to Content
0

Sapui5 one before day problem

Dec 20, 2017 at 11:12 AM

102

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Joseph BERTHE Dec 21, 2017 at 10:19 PM
0

You have to play with the timezone such as CET to get the correct date.

Share
10 |10000 characters needed characters left characters exceeded
Irfan Gokak Dec 20, 2017 at 02:15 PM
0

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;
},
Show 2 Share
10 |10000 characters needed characters left characters exceeded

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.

tarih-sorunu.png (27.2 kB)
tarihsorn2.png (9.6 kB)
0

Try this

var sPath = "/MainSet?$filter=Pernr eq '"+this.pernr+"' and 'Tarih eq datetime'"+dDate+"'";
// After this make odata call
0
Iftah Peretz
Dec 20, 2017 at 03:41 PM
0

Hi,

In addition to handling it on the front-end (to add on the point already made), you can add a day on the back-end ABAP side.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
I used abap code it elsewhere.So I can not change it there.But the problem is solved by itself.I didntunderstand. 2-3 hour after i checked code problem solved.

Thanks for answer.



0
Jun Wu Dec 20, 2017 at 04:39 PM
0

it may not be a problem, the browser is showing local time, the abap side is showing server time,

Share
10 |10000 characters needed characters left characters exceeded