SAP UI5应用里类型为Edm.DateTime的日期控件设计原理.docx

上传人:A*** 文档编号:143360066 上传时间:2020-08-28 格式:DOCX 页数:5 大小:883.09KB
返回 下载 相关 举报
SAP UI5应用里类型为Edm.DateTime的日期控件设计原理.docx_第1页
第1页 / 共5页
SAP UI5应用里类型为Edm.DateTime的日期控件设计原理.docx_第2页
第2页 / 共5页
SAP UI5应用里类型为Edm.DateTime的日期控件设计原理.docx_第3页
第3页 / 共5页
SAP UI5应用里类型为Edm.DateTime的日期控件设计原理.docx_第4页
第4页 / 共5页
SAP UI5应用里类型为Edm.DateTime的日期控件设计原理.docx_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《SAP UI5应用里类型为Edm.DateTime的日期控件设计原理.docx》由会员分享,可在线阅读,更多相关《SAP UI5应用里类型为Edm.DateTime的日期控件设计原理.docx(5页珍藏版)》请在金锄头文库上搜索。

1、SAP UI5应用里类型为Edm.DateTime的日期控件设计原理Recently I was struggled with a customer incident and finally I realized that I didnt understand the Edm.DateTime quite clearly. So I spend some time to do research on it to fix my knowledge gap. I list my learning here in case any other guy needs it as well.For my

2、study, I use this field in my application for example.It is bound to json model field “ClosingDate” with a formatter.In the metadata, this field is defined with type Edm.DateTime (Represents date and time with values ranging from 12:00:00 midnight, January 1, 1753 A.D. through 11:59:59 P.M, December

3、 9999 A.D.)After I change the closingDate to 2015-10-3 and save the change:The saved opportunity is reread from backend with an odata request. In Chrome network tab I observed the closingDate has this format: /Date(1443830400000)/:What makes me curious is when I directly paste the url of the odata r

4、equest to Chrome or SAP gateway client, I get the closingDate with this format instead. The figure below is response in Chrome:And this is response from gateway client.Why is there difference between them?And when I type “alert(new Date(1443830400000);” in chrome console, I get this popup:Actually i

5、t ( 2015-10-03 08:00:00 GMT +0800 ) points to exactly the same time as 2015-10-03 00:00:00 UTC.So how could the date with format /Date(1443830400000)/ be consumed in my application?It makes sense to start debugging via the framework handler when the response of odata request ( Opportunity re-read af

6、ter closing date is changed ) is successfully returned:check the body field:The aim is to figure out how framework parses this /Date(1443744000000)/.Then I reached the place:(1) there is a regular expression which extracts the number 1443744000000 from the input string.(2) a local time is returned b

7、y new Date(), with the number parsed by previous step passed in. The local time is returned based on current Time zone configured in my laptop.Thanks to the framework, which has parsed the raw json response string to Javascript object, so that we application could directly use the converted object t

8、o bind our model.Then the local time returned by framework will be passed into my formatter so now I could do any formatting based on customer requirement:外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-V7xzygvx-1596956679633)(https:/upload-images.jianshu.io/upload_images/2085791-bfe738ad92f3cb66.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)要获取更多Jerry的原创文章,请关注公众号汪子熙:

展开阅读全文
相关资源
相关搜索

当前位置:首页 > IT计算机/网络 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号