openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

DateFormat.DateTimeWithTimezone.parse: further specify return value

Open BenReim opened this issue 3 years ago • 3 comments

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.

BenReim avatar Mar 14 '23 14:03 BenReim

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.

JumpNRun avatar Mar 16 '23 17:03 JumpNRun

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 avatar Mar 17 '23 11:03 viktorsperling

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

viktorsperling avatar Mar 23 '23 15:03 viktorsperling