SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.95k stars 1.23k forks source link

DateFormat.DateTimeWithTimezone.parse: further specify return value #3715

Closed BenReim closed 1 year ago

BenReim commented 1 year ago

OpenUI5 version: 1.111.0

Steps to reproduce the problem:

Currently, the return type of sap.ui.core.format.DateFormat.DateTimeWithTimezone.parse is simply an Array

// parseResults: any[]
const parseResults = DateFormat.getDateTimeWithTimezoneInstance({showTimezone: false}).parse(sCurrentValue, sTimezone);

What is the expected result? A developer would benefit from a consistent and more strongly typed return value.

JumpNRun commented 1 year ago

Hi, Thank you for sharing this finding. I've created an internal incident 2370017980. The status of the issue will be updated here in GitHub.

viktorsperling commented 1 year ago

Thank you for your request, I've created a change improving the documented return value of the method as followed:

@return {Array<Date|undefined, string|undefined>} the parsed values

This format was chosen since, the values in the array may be undefined depending on the format options you chose showDate: false, showTime: false or showTimezone: false.

For further information on the API feel free to checkout or public API reference.

viktorsperling commented 1 year ago

Hello BenReim,

after a deeper investigation I've found out my previously suggest solution is not applicable. Nevertheless, I was able to implement and submit the requested change in form of an overlay. The requested documentation will be available in version 1.113.

Thanks again for your request and best regards, Viktor