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
Units: Format currency with negative before the symbol #65152
Conversation
You have successfully added a new CodeQL configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fast and elegant solution! Played around with it, and works great. LGTM!
@@ -5,16 +5,23 @@ import { scaledUnits, ValueFormatter } from './valueFormats'; | |||
export function currency(symbol: string, asSuffix?: boolean): ValueFormatter { | |||
const units = ['', 'K', 'M', 'B', 'T']; | |||
const scaler = scaledUnits(1000, units); | |||
return (size: number, decimals?: DecimalCount, scaledDecimals?: DecimalCount) => { | |||
if (size === null) { | |||
return (value: number, decimals?: DecimalCount, scaledDecimals?: DecimalCount) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good change here, value makes way more sense.
Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
What is this feature?
We currently format negative monies as
$-100
and it should be-$100
Why do we need this feature?
to be more normal
Who is this feature for?
[Add information on what kind of user the feature is for.]
Which issue(s) does this PR fix?:
Fixes #65123
Special notes for your reviewer:
Please check that: