当前位置:网站首页>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 ”:
边栏推荐
- sublime text中conda环境中plt.show无法弹出显示图片的问题
- vb.net 随窗口改变,缩放控件大小以及保持相对位置
- Purpose of computer F1-F12
- Deep anatomy of C language -- C language keywords
- 超高效!Swagger-Yapi的秘密
- What is CSRF (Cross Site Request Forgery)?
- torch建立的网络模型使用torchviz显示
- Navicat Premium 创建MySql 创建存储过程
- LeetCode:剑指 Offer 42. 连续子数组的最大和
- Esp8266-rtos IOT development
猜你喜欢

Deep analysis of C language pointer

Unified ordering background interface product description Chinese garbled

可变长参数

Deep anatomy of C language -- C language keywords

Navicat Premium 创建MySql 创建存储过程

广州推进儿童友好城市建设,将探索学校周边200米设安全区域

被破解毁掉的国产游戏之光

Problems in loading and saving pytorch trained models

marathon-envs项目环境配置(强化学习模仿参考动作)

ESP8266-RTOS物联网开发
随机推荐
What is CSRF (Cross Site Request Forgery)?
Esp8266-rtos IOT development
poi追加写EXCEL文件
egg. JS directory structure
Indentation of tabs and spaces when writing programs for sublime text
【嵌入式】使用JLINK RTT打印log
R language ggplot2 visualization: place the title of the visualization image in the upper left corner of the image (customize Title position in top left of ggplot2 graph)
pytorch训练好的模型在加载和保存过程中的问题
LeetCode:41. 缺失的第一个正数
LeetCode:剑指 Offer 03. 数组中重复的数字
Bitwise logical operator
C語言雙指針——經典題型
egg. JS getting started navigation: installation, use and learning
LeetCode:剑指 Offer 48. 最长不含重复字符的子字符串
Detailed explanation of heap sorting
C语言深度解剖——C语言关键字
广州推进儿童友好城市建设,将探索学校周边200米设安全区域
Sublime text in CONDA environment plt Show cannot pop up the problem of displaying pictures
Warning in install. packages : package ‘RGtk2’ is not available for this version of R
Super efficient! The secret of swagger Yapi