当前位置:网站首页>SAP ui5 date type sap ui. model. type. Analysis of the parsing format of date
SAP ui5 date type sap ui. model. type. Analysis of the parsing format of date
2022-07-06 08:48:00 【Wang Zixi】
I developed a SAP UI5 application , Data type used sap.ui.model.type.Date
, And specify the display format pattern
by :yyyy-MM-ddTHH:mm:ss
:
<ObjectAttribute title="{i18n>dateTitle}" text="{ path: 'invoice>ShippedDate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'long', source: { pattern: 'yyyy-MM-ddTHH:mm:ss' } } }"/>
The value of the data source bound to this field is :2015-04-01T01:20:59
I look forward to SAP UI5 The format displayed on the is One year - a certain month - One day -T- Hours - branch - second
, But the final display effect is shown in the figure below :April 1,2015
This article introduces how to analyze the problem of this display format .
We are Chrome Found in the developer tool sap.ui.model.type.Date
Implementation file address of :
sap/ui/model/type/Date.js
First, in the function Date1.prototype.formatValue
To set breakpoints , Observe the original value of string type , The function has been successfully passed in :
sInternalType
Value :string
string Type of PrimitiveType
The value is itself .
The logic is defined in the following functions :
SimpleType.prototype.getPrimitiveType = function (sInternalType) {
// Avoid dealing with type objects, unless really necessary
switch (sInternalType) {
case "any":
case "boolean":
case "int":
case "float":
case "string":
case "object":
return sInternalType;
default:
var oInternalType = DataType.getType(sInternalType);
return oInternalType && oInternalType.getPrimitiveType().getName();
}
};
Get the template of format data from the model :
For example, the abbreviation of seven days a week , Stored in aDaysAbbrev
in :
A year 12 Months of words , Stored in aMonthsWide
in :
Get into parse Internal function ,Calendar type by :Gregorian
, intend The solar calendar
.
Calendar type For enumeration value , All those who support calendar The type is shown in the figure below :
Format the value of the array :aFormatArray
Has successfully resolved 2015 year 4 month 2 The day :
Start parsing :T01:20:30
All possible Date separator
:
\u002d\u007E\u2010\u2011\u2012\u2013\u2014\ufe58\ufe63\uff0d\uFF5E
stay Dateformat.js
Functional _parse
The return value of the function , It has been observed for hours , Minutes and seconds have been successfully resolved . So the problem is not parsing , But in the display of values .
Last returned value :Thu Apr 02 2015 01:20:30 GMT+0800 (China Standard Time
more Jerry The original article of , All in :“ Wang Zixi ”:
边栏推荐
- 自动化测试框架有什么作用?上海专业第三方软件测试公司安利
- swagger设置字段required必填
- Bitwise logical operator
- Screenshot in win10 system, win+prtsc save location
- Delay initialization and sealing classes
- Roguelike游戏成破解重灾区,如何破局?
- On the inverse order problem of 01 knapsack problem in one-dimensional state
- Deep analysis of C language data storage in memory
- Deep anatomy of C language -- C language keywords
- LeetCode:剑指 Offer 42. 连续子数组的最大和
猜你喜欢
Using C language to complete a simple calculator (function pointer array and callback function)
Current situation and trend of character animation
【ROS】usb_ Cam camera calibration
pytorch训练好的模型在加载和保存过程中的问题
704 binary search
Esp8266-rtos IOT development
C语言双指针——经典题型
Sublime text in CONDA environment plt Show cannot pop up the problem of displaying pictures
LeetCode:221. 最大正方形
MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object
随机推荐
Precise query of tree tree
China polyether amine Market Forecast and investment strategy report (2022 Edition)
Bitwise logical operator
[embedded] print log using JLINK RTT
LeetCode:34. 在排序数组中查找元素的第一个和最后一个位置
Delay initialization and sealing classes
View computer devices in LAN
Marathon envs project environment configuration (strengthen learning and imitate reference actions)
The harm of game unpacking and the importance of resource encryption
China's high purity aluminum target market status and investment forecast report (2022 Edition)
如何有效地进行自动化测试?
LeetCode:498. 对角线遍历
hutool优雅解析URL链接并获取参数
Tdengine biweekly selection of community issues | phase III
ESP8266-RTOS物联网开发
C語言雙指針——經典題型
China dihydrolaurenol market forecast and investment strategy report (2022 Edition)
软件压力测试常见流程有哪些?专业出具软件测试报告公司分享
JVM quick start
广州推进儿童友好城市建设,将探索学校周边200米设安全区域