当前位置:网站首页>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 ”:
边栏推荐
- Possible to restore a backup of SQL Server 2014 on SQL Server 2012?
- Reptile learning winter vacation series (2)
- OSI seven layer reference model
- 3W word will help you master the C language as soon as you get started - the latest update is up to 5.22
- How to use the mongodb ID array to get multiple documents- How to get multiple document using array of MongoDb id?
- Experiment 7. IPv6
- Common built-in modules
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 9
- Attributes and methods in math library
- Iptables cause heartbeat brain fissure
猜你喜欢
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 23](/img/72/a80ee7ee7b967b0afa6018070d03c9.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 23

CSDN documentation specification

QQ group collection
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14](/img/c5/dde92f887e8e73d7db869fcddc107f.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14

Detailed array expansion analysis --- take you step by step analysis

(August 10, 2021) web crawler learning - Chinese University ranking directed crawler
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 7](/img/44/1861f9016e959ed7c568721dd892db.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 7

SQL greatest() function instance detailed example
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11](/img/6a/398d9cceecdd9d7c9c4613d8b5ca27.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11
![Entitas learning [3] multi context system](/img/f9/a3ce86ff2121dd1043305b7e834cc5.jpg)
Entitas learning [3] multi context system
随机推荐
os. Path built-in module
守护进程Xinted和日志记录Syslogd
Practical dry goods: deploy mini version message queue based on redis6.0
Exceptions and exception handling
3W word will help you master the C language as soon as you get started - the latest update is up to 5.22
LxC shared directory permission configuration
Getting started with window functions
三立期货安全么?期货开户怎么开?目前期货手续费怎么降低?
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 14
Analysis function in SQL
Properties and methods of OS Library
If function in SQL
About the use of URL, href, SRC attributes
Using terminal connection in different modes of virtual machine
Function parameters (positional parameters, default value parameters, variable parameters, named keyword parameters, keyword parameters)
Experiment 7. IPv6
OSI seven layer reference model
netstat
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 24
(2021-08-20) web crawler learning 2