当前位置:网站首页>SAP ui5 date type sap ui. model. type. Analysis of the display format of date
SAP ui5 date type sap ui. model. type. Analysis of the display format of date
2022-07-04 11:57: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 .
In the previous article , We have ruled out that this problem is caused by data parsing errors , Because in DateFormat.js
Of _format Method input parameters oJSDate
, It has been possible to observe correctly from the local JSON The file parsed contains Hours , branch , second
Time value of :Thu Apr 02 2015 01:20:30 GMT+0800 (China Standard Time)
this.aFormatArray
Only five records are included , Excluding hours , branch , second , Therefore, the last output time is only mm / DD / yyyy .
analysis aFormatArray
Data source :
this.aFormatArray = this.parseCldrDatePattern(this.oFormatOptions.pattern);
Run time debugging :this.oFormatOptions.pattern The value of is MMddyyyy
We are xml Specified in the view pattern, Can be in callstack See in :
XML View address , be located One suit SAP UI5 Step by step learning tutorials for developers Step No 34:
pattern: ‘yyyy-MM-ddTHH:mm:ss’
We xml The view only provides source-pattern, instead of pattern, therefore ,SAP UI5 frame , You need to call the following code to generate pattern:
oFormat.oFormatOptions.pattern = oInfo.getPattern(oFormat.oLocaleData, oFormat.oFormatOptions.style, oFormat.oFormatOptions.calendarType);
from SAP UI5 Generate Pattern
To see , We xml Provided in the view pattern Not considered as an input parameter :
getDatePattern: function(sStyle, sCalendarType) {
assert(sStyle == "short" || sStyle == "medium" || sStyle == "long" || sStyle == "full", "sStyle must be short, medium, long or full");
return this._get(getCLDRCalendarName(sCalendarType), "dateFormats", sStyle);
},
style Support full, And what I specified was long
.
If I set it to full, The display effect is as follows :Thursday, April 2, 2015
more Jerry The original article of , All in :“ Wang Zixi ”:
边栏推荐
- Local MySQL forgot the password modification method (Windows)
- 8.8.1-PointersOnC-20220214
- (2021-08-20) web crawler learning 2
- Data transmission in the network
- Postman advanced
- 'using an alias column in the where clause in PostgreSQL' - using an alias column in the where clause in PostgreSQL
- Detailed explanation of classic process synchronization problems
- (August 10, 2021) web crawler learning - Chinese University ranking directed crawler
- TCP fast retransmission sack mechanism
- 2020 Summary - Magic year, magic me
猜你喜欢
Properties and methods of OS Library
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13
Ultimate bug finding method - two points
Entitas learning [iv] other common knowledge points
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
Entitas learning [3] multi context system
Replace() function
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 19
QQ group administrators
OSI seven layer model & unit
随机推荐
Dos and path
Practical dry goods: deploy mini version message queue based on redis6.0
Heartbeat启动后无反应
Login operation (for user name and password)
Process communication and thread explanation
Introduction of network security research direction of Shanghai Jiaotong University
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 10
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14
Recommend a cool geospatial data visualization tool with low code
VPS installation virtualmin panel
OSI model notes
C language compilation process
03_ Armv8 instruction set introduction load and store instructions
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 9
Serialization oriented - pickle library, JSON Library
(August 10, 2021) web crawler learning - Chinese University ranking directed crawler
Lvs+kept realizes four layers of load and high availability
2020 Summary - Magic year, magic me
Shift EC20 mode and switch
World document to picture