File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -143,10 +143,20 @@ function formatSignedHoldingAmount(value) {
143143}
144144
145145function formatPnlRatePercent ( value ) {
146- const percentValue = roundToInteger ( Number ( value ) * 100 ) ;
147- const sign = percentValue > 0 ? '+' : '' ;
146+ const numericValue = Number ( value ) ;
148147
149- return `${ sign } ${ percentValue } %` ;
148+ if ( ! Number . isFinite ( numericValue ) ) {
149+ return '0.0%' ;
150+ }
151+
152+ const roundedPercentValue = Number ( ( numericValue * 100 ) . toFixed ( 1 ) ) ;
153+ const normalizedPercentValue =
154+ Object . is ( roundedPercentValue , - 0 ) || roundedPercentValue === 0
155+ ? 0
156+ : roundedPercentValue ;
157+ const sign = normalizedPercentValue > 0 ? '+' : '' ;
158+
159+ return `${ sign } ${ normalizedPercentValue . toFixed ( 1 ) } %` ;
150160}
151161
152162function getHoldingPnlClassName ( pnlRate ) {
You can’t perform that action at this time.
0 commit comments