当前位置:网站首页>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 ”:
边栏推荐
- Simple use of promise in uniapp
- sublime text没关闭其他运行就使用CTRL+b运行另外的程序问题
- Chrome浏览器的crash问题
- Cesium draw points, lines, and faces
- LeetCode:387. 字符串中的第一个唯一字符
- Swagger setting field required is mandatory
- pytorch训练好的模型在加载和保存过程中的问题
- Target detection - pytorch uses mobilenet series (V1, V2, V3) to build yolov4 target detection platform
- Purpose of computer F1-F12
- Marathon envs project environment configuration (strengthen learning and imitate reference actions)
猜你喜欢
sublime text的编写程序时的Tab和空格缩进问题
C語言雙指針——經典題型
C语言双指针——经典题型
Variable length parameter
PC easy to use essential software (used)
C语言深度解剖——C语言关键字
【嵌入式】Cortex M4F DSP库
Unified ordering background interface product description Chinese garbled
Current situation and trend of character animation
Trying to use is on a network resource that is unavailable
随机推荐
角色动画(Character Animation)的现状与趋势
Chrome浏览器的crash问题
Fairguard game reinforcement: under the upsurge of game going to sea, game security is facing new challenges
The network model established by torch is displayed by torch viz
Detailed explanation of heap sorting
项目连接数据库遇到的问题及解决
[embedded] print log using JLINK RTT
Charging interface docking tutorial of enterprise and micro service provider platform
ESP8266-RTOS物联网开发
被破解毁掉的国产游戏之光
China's high purity aluminum target market status and investment forecast report (2022 Edition)
个人电脑好用必备软件(使用过)
Delay initialization and sealing classes
LeetCode:剑指 Offer 48. 最长不含重复字符的子字符串
Problems in loading and saving pytorch trained models
C语言双指针——经典题型
优秀的软件测试人员,都具备这些能力
Purpose of computer F1-F12
POI add write excel file
MySQL learning record 11jdbcstatement object, SQL injection problem and Preparedstatement object