Skip to content

Commit

Permalink
Buy plugin: Improve number formatting
Browse files Browse the repository at this point in the history
Allows for positive and negative numbers
  • Loading branch information
lukasbestle committed Oct 26, 2024
1 parent af279b4 commit eb85f6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion site/plugins/buy/src/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function discounts(): string
$discounts = [];

if ($this->rateAdjusted !== $this->rate) {
$pppPercentage = number_format(100 * (1 - $this->rateAdjusted / $this->rate), 2, '.');
$pppPercentage = sprintf('%+1.2F', 100 * (1 - $this->rateAdjusted / $this->rate));
$discounts[] = 'PPP (' . $pppPercentage . '%)';
}

Expand Down

0 comments on commit eb85f6d

Please sign in to comment.