`
JerryWang_SAP
  • 浏览: 1001306 次
  • 性别: Icon_minigender_1
  • 来自: 成都
文章分类
社区版块
存档分类
最新评论

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

阅读更多

Recently I was struggled with a customer incident and finally I realized that I didn’t 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 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 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 request 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 it ( 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 after 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 by 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 to 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:

 

 

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

0
1
分享到:
评论

相关推荐

    edm.rar_edm

    在本案例中,“edm.rar_edm”可能是一个包含关于如何使用Gmail服务来发送EDM的教程或资源的压缩文件。下面我们将详细探讨EDM营销及其与Gmail的结合使用。 首先,了解EDM营销的基本概念非常重要。EDM的目标是通过...

    edm.zip_UG_edm_grip_ug二次_放电

    本压缩包“edm.zip_UG_edm_grip_ug二次_放电”中包含的资源,是针对UG EDM Grip的二次开发实例,通过编写一系列子程序,可以自动生成EDM放电所需的图纸。这些子程序包括: 1. `_use.gri`:这是使用或调用其他子程序...

    SY1020_edm.prt

    SY1020_edm.prt

    EDM.lassical.information.theory.rar_INFORMATION THEORY_edm_theor

    《电磁波测距原理经典资料》是一份深入探讨信息理论在电磁波测距技术中应用的重要文献。信息理论,作为通信工程和信号处理的基础,由克劳德·香农在20世纪40年代创立,它揭示了信息的数学本质,并为数据传输、编码和...

    EDM.xmind

    EDM.xmind

    edm.zip_easyui_excel服务器_java 在线 预览_web处理excel_预览excel

    标题中的“edm.zip_easyui_excel服务器_java 在线_预览_web处理excel_预览excel”表明这是一个关于使用Java开发的Web应用,该应用集成了EasyUI框架,支持Excel服务器处理和在线预览功能。让我们详细了解一下这些关键...

    [MMS_049390]Factory Talk View ME Face Plate for 9300-8EDM.rar

    【FactoryTalk View ME Face Plate for 9300-8EDM】是Allen Bradley(AB)公司提供的一个工业自动化解决方案,主要用于人机交互界面(HMI)的设计与配置。FactoryTalk View是Rockwell Automation(罗克韦尔自动化)...

    天天音乐网站前台vue3-edm.zip

    音乐商城是一个在线平台,用于销售音乐作品...移动应用开发:包括iOS开发(使用Swift或Objective-C)和Android开发(使用Java或Kotlin)等。 大数据技术:包括Hadoop、Spark、Hive等用于处理和分析大规模数据集的技术。

    EDM.zip_EMD_edm_periodb4s_模态 period_经验模态分解

    经验模态分解实例程序,供刚开始接触EMD的同学学习参考

    长沙新华电脑EDM营销.zip

    EDM(Email Direct Marketing)是电子邮件直接营销的缩写,是一种通过发送电子邮件向目标客户传递信息、推广产品或服务的网络营销策略。在“长沙新华电脑EDM营销.zip”这个压缩包中,我们可以推测其主要内容是关于...

    施耐德电气EDM产品选型册.pdf

    EDM系统可以处理诸如设计数据、图纸、技术文档和产品配置信息。这些系统通常支持数据的存储、检索、修改和共享,以及确保数据的版本控制和数据完整性。在电气工程中,EDM也可能指电火花加工技术,这是一种利用连续...

    SC+EDM.rar_C++_LBM_droplet_lattice boltzmann_伪式模型

    利用格子——Boltzmann方法,伪式模型, 编程实现液滴演变

    长沙新华电脑EDM营销.pptx

    长沙新华电脑EDM营销.pptx

    数据仓库 EDM 3.0

    ### 数据仓库 EDM 3.0 相关知识点 #### 一、EDA的指导思想与EDW建设的核心 EDA(Event-Driven Architecture,事件驱动架构)的指导思想是通过响应事件来触发系统的处理流程,实现系统间高效灵活的交互。这种架构...

    中国电信EDM3.0规范

    在实际应用中,EDM3.0规范指导了数据库的设计和维护,使得数据的管理和使用更加高效。例如,通过概念模型,可以清晰地理解不同业务领域的数据结构;逻辑模型则帮助开发团队将这些概念转化为可操作的数据库结构;而...

    YL-291单元电子电路模块配培训手指导书V2.1

    5.EDM105-空气质量传感器电路 ..................................................................... 16 6.EDM106 烟雾传感器电路 ...........................................................................

Global site tag (gtag.js) - Google Analytics