当前位置:网站首页>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 ”:
边栏推荐
- Summary of Shanghai Jiaotong University postgraduate entrance examination module -- cryptography
- VPS安装Virtualmin面板
- Post man JSON script version conversion
- Properties and methods of OS Library
- Cacti主机模板之定制版
- Btrace tells you how to debug online without restarting the JVM
- If function in SQL
- Here, the DDS tutorial you want | first experience of fastdds - source code compilation & Installation & Testing
- Detailed array expansion analysis --- take you step by step analysis
- QQ get group link, QR code
猜你喜欢
Review of week 278 of leetcode II
2020 Summary - Magic year, magic me
Force buckle 142 Circular linked list II
20 kinds of hardware engineers must be aware of basic components | the latest update to 8.13
(2021-08-20) web crawler learning 2
Summary of Shanghai Jiaotong University postgraduate entrance examination module firewall technology
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
OSI seven layer model & unit
Ternsort model integration summary
随机推荐
How to use the mongodb ID array to get multiple documents- How to get multiple document using array of MongoDb id?
VPS installation virtualmin panel
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11
IO stream ----- open
Snowflake won the 2021 annual database
Simple understanding of generics
Decrypt the advantages of low code and unlock efficient application development
A few words explain redis cache penetration, breakdown, avalanche, and redis sentinel
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
本地Mysql忘记密码的修改方法(windows)[通俗易懂]
Global function Encyclopedia
Definition and method of string
Xiaobing · beauty appraisal
Detailed array expansion analysis --- take you step by step analysis
Dos and path
About the use of URL, href, SRC attributes
Iptables cause heartbeat brain fissure
Login operation (for user name and password)
Common built-in modules
Test question bank management system - database design [easy to understand]