cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Sapui5 date one day missing

0 Kudos
6,542

I want to show the date I got with DatePicker in a section in a table. But the date is missing 1 day.


I tried many methods:
https://answers.sap.com/questions/409976/sap-webide---ui5---date-field-is-not-showing-corre.html

https://answers.sap.com/questions/323063/date-value-is-getting-reduced-by-one-day-while-pas.html

But it didn't work. What is your suggestion?

View Entire Topic
Jagtar
Participant
0 Kudos

Can you please share your view binding code for date picker.
If you can't share then can you tell if its live binding with odata model or with local json model.

We have same problem in both type binding above given binding will work if its directly binded from odata model.

if you are first copying data to local model then bindind then you need to apply one formatter also .

let us know how you binded?

0 Kudos

I used OData Model.

For Tarih (date) field:

My fragment.view

...
<content>
<f:SimpleForm editable="true" layout="ResponsiveGridLayout" labelSpanXL="3" labelSpanL="3" labelSpanS="12" adjustLabelSpan="false" emptySpanXL="4" emptySpanL="4" emptySpanM="4" emptySpanS="0" columnsXL="1" columnsL="1" columnsM="1" singleConteinerFullSize="false">
	<f:content>
		<DatePicker id="dpKayitTarih"/>
	</f:content>
</f:SimpleForm>
</content>
<buttons>
	<Button text="{i18n>kaydet}" press="onKayitFrag" type="Transparent"/>
	<Button text="{i18n>geri}" press="onGeriFrag" type="Transparent"/>
</buttons>
...
My Worklist.view
<Table>
...
<items>
	<ColumnListItem>
		<cells>
			<Text text="{path: 'Tarih', type: 'sap.ui.model.type.DateTime', formatOptions: { strictParsing: true , UTC: true}}"/>
		</cells>
	</ColumnListItem>
</items>
</Table>

My controller.js/onKayitFrag

onKayitFrag: function() {
	var that = this;
	var vTarih = sap.ui.getCore().byId("dpKayitTarih").getDateValue();
	var sData = {
		Tarih: vTarih
	};
	sap.ui.core.BusyIndicator.show();
	this.getView().getModel().create("/ListSet", sData, {
		success: function(oData) {
			sap.ui.core.BusyIndicator.hide();
			that._getKayitDialog().close();
			that.onRefresh();
			MessageToast.show("Başarılı");
		},
		error: function(oError) {
			sap.ui.core.BusyIndicator.hide();
			that._getKayitDialog().close();
			MessageToast.show("Başarısız");
		}
	});
}<br>