Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RoundingMode Key-Value Pairs Not Identical #2169

Closed
boghyon opened this issue Aug 17, 2018 · 2 comments
Closed

RoundingMode Key-Value Pairs Not Identical #2169

boghyon opened this issue Aug 17, 2018 · 2 comments

Comments

@boghyon
Copy link
Contributor

boghyon commented Aug 17, 2018

Currently, the RoundingMode key-value pairs are not identical to each other.

* @enum {string}
* @alias sap.ui.core.format.NumberFormat.RoundingMode
*/
var mRoundingMode = {
/**
* Rounding mode to round towards negative infinity
* @public
*/
FLOOR: "floor",
/**
* Rounding mode to round towards positive infinity
* @public
*/
CEILING: "ceiling",
/**
* Rounding mode to round towards zero
* @public
*/
TOWARDS_ZERO: "towards_zero",
/**
* Rounding mode to round away from zero
* @public
*/
AWAY_FROM_ZERO: "away_from_zero",
/**
* Rounding mode to round towards the nearest neighbor unless both neighbors are equidistant, in which case round towards negative infinity.
* @public
*/
HALF_FLOOR: "half_floor",
/**
* Rounding mode to round towards the nearest neighbor unless both neighbors are equidistant, in which case round towards positive infinity.
* @public
*/
HALF_CEILING: "half_ceiling",
/**
* Rounding mode to round towards the nearest neighbor unless both neighbors are equidistant, in which case round towards zero.
* @public
*/
HALF_TOWARDS_ZERO: "half_towards_zero",
/**
* Rounding mode to round towards the nearest neighbor unless both neighbors are equidistant, in which case round away from zero.
* @public
*/
HALF_AWAY_FROM_ZERO: "half_away_from_zero"
};

Why is this a problem?

Besides the doc saying to do so; When developing something declaratively (e.g. XML views), the actual values must be passed ("floor") instead of key names ("FLOOR").

  1. Usually in JS, we can get the real values via sap.ui.define / .require. We can't do that in declarative views.
  2. There is currently no way to discover them without inspecting the source code since only keys are visible in API reference.

And since NumberFormat instances are not derived from ManagedObject, there is no implicit type validation either: When instantiated with an invalid roundingMode value, either a vague or no errors are thrown perplexing the developer even more.


Similar issue: #2162

@GerganaKremenska
Copy link
Member

Hello @boghyon ,
Thank you for sharing this finding. I've created an internal incident 1870335948. The status of the issue will be updated here in GitHub.
Regards,
Gergana

@stopcoder
Copy link
Member

Hi @boghyon,

we finally made a fix and it's merged to the master branch a moment ago. We decided not to downport the fix. If you need this fix in the released branch as well, please reopen the ticket with the version info. We will then consider downporting the change.

Best regards,
Jiawei

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants