当前位置:网站首页>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 ”:
边栏推荐
- 按位逻辑运算符
- 个人电脑好用必备软件(使用过)
- Indentation of tabs and spaces when writing programs for sublime text
- How to conduct interface test? What are the precautions? Nanny level interpretation
- egg. JS getting started navigation: installation, use and learning
- LeetCode:34. 在排序数组中查找元素的第一个和最后一个位置
- Introduction to the differences between compiler options of GCC dynamic library FPIC and FPIC
- Hutool gracefully parses URL links and obtains parameters
- TP-LINK enterprise router PPTP configuration
- gcc动态库fPIC和fpic编译选项差异介绍
猜你喜欢
sublime text中conda环境中plt.show无法弹出显示图片的问题
Delay initialization and sealing classes
Charging interface docking tutorial of enterprise and micro service provider platform
marathon-envs项目环境配置(强化学习模仿参考动作)
Warning in install. packages : package ‘RGtk2’ is not available for this version of R
Precise query of tree tree
【剑指offer】序列化二叉树
ROS compilation calls the third-party dynamic library (xxx.so)
Unsupported operation exception
软件卸载时遇到trying to use is on a network resource that is unavailable
随机推荐
软件卸载时遇到trying to use is on a network resource that is unavailable
R language uses the principal function of psych package to perform principal component analysis on the specified data set. PCA performs data dimensionality reduction (input as correlation matrix), cus
Generator parameters incoming parameters
企微服务商平台收费接口对接教程
项目连接数据库遇到的问题及解决
生成器参数传入参数
LeetCode:162. 寻找峰值
Computer graduation design PHP Zhiduo online learning platform
Sublime text using ctrl+b to run another program without closing other runs
Cesium draw points, lines, and faces
LeetCode:剑指 Offer 04. 二维数组中的查找
可变长参数
Unsupported operation exception
Current situation and trend of character animation
After PCD is converted to ply, it cannot be opened in meshlab, prompting error details: ignored EOF
Roguelike game into crack the hardest hit areas, how to break the bureau?
JS pure function
TP-LINK enterprise router PPTP configuration
Tdengine biweekly selection of community issues | phase III
What is the role of automated testing frameworks? Shanghai professional third-party software testing company Amway