How to handle Edm:DateTime form OData interface in SAPUI5 correct? -


is there definition values should send in odata edm:datetime of sap netweaver gateway service? should interpreted utc?

i assume sapui5 library smart enough handle time zone problems automatically if interface correct defined -- question is, correct?

i prefer use code this, @ client side:

new sap.m.datepicker({      value : {          path : "birthdate",          type : new sap.ui.model.type.date      } }), 

how solve these problems?

edit

time zone handling seems still strange me. sap gateway server sends in edm:datetime following: 2015-04-16t00:00:00 time zone information missing.

if bind date picker this:

var ocontent = new sap.m.datepicker({     value : {         path : "date",         type : new sap.ui.model.type.date({                     style: "short",                 })     } }) 

i got following output: 16.04.15 (seems correct). binding date picker without type information shows: thu apr 16 2015 02:00:00 gmt+0200 (mitteleuropäische sommerzeit)

if change date date picker 17.04.15 second line is: fri apr 17 2015 00:00:00 gmt+0200 (mitteleuropäische sommerzeit) please note difference in time (2 hours missing).

if send server got edm.datetime == 2015-04-16t00:00:00 control shows: thu apr 16 2015 02:00:00 gmt+0200 (mitteleuropäische sommerzeit)

if use

new sap.m.datepicker({ value : {     path : "date",     type : new sap.ui.model.type.date({                 style: "short",                 utc: true         }) } }) 

data seems correct (the 2 hours not missing after picking new date).

i asking me, there definition type of data gateway send? if timezone missing inside edm.datetime information how should client work correct? if clients in different time zones available?

strange enough have similar problem using filter. there utc flag seems not working.

anyone experience on topic? or hints documentation? * https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/91f3070d6f4d1014b6dd926db0e91070.html says more or less "take care" not how :-/

further information

i detected same question on sap network (http://scn.sap.com/thread/3574419). not sure if given answer correct. looks hacking around in meta-data should not required?

i still searching solution problem

i detected different handling of data in case of binding , filter usage.

i can't answer regard sap, not familiar. can provide insights based on odata.

the edm:datetime type based on w3c xml schema xs:datetime, in-turn based on iso8601. both xml schema , iso8601 state times without time zone considered "local time". is, local someone. "local" intentionally undefined.

from w3c xml schema §3.2.7:

"local" or untimezoned times presumed time in timezone of unspecified locality prescribed appropriate legal authority

from iso 8601 3rd edition §4.3.2:

the zone designator empty if use made of local time ...

consider example of 2015-04-16t00:00:00. way know exact moment in time refers have additional context applied. in case of birthday, time zone person located (where celebrate birthday, not born). or, arbitrary location if person's location unknown - perhaps time zone of person using system.

therefore, interpretation of value time zone being applied. in case, appear local time zone being applied during deserialization.

also consider birthday better represented calendar date, rather midnight on date. edm:date type better suited this. other types, if know value utc or in specific time zone, edm:datetimeoffset more appropriate.

also recognize edm:datetime type dropped odata spec in version 4.0. many (including myself) consider mistake. i'm not sure if affects or not, should aware.

hope helps.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -