Skip to content

Commit 794ae58

Browse files
committed
fix
1 parent 79a8c22 commit 794ae58

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Forex.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ public function convert(
112112

113113
$currency = is_string($currency) ? $currency : $currency->getCurrencyCode();
114114

115-
if ($money->getCurrency()->is($currency)) {
115+
$sourceCurrency = $money->getCurrency()->getCurrencyCode();
116+
117+
if ($sourceCurrency === $currency) {
116118
return $money;
117119
}
118120

119-
$rates = $date ? $this->rates($date, $currency) : $this->latest($currency);
121+
$rates = $date ? $this->rates($date, $sourceCurrency) : $this->latest($sourceCurrency);
120122

121123
$provider = new BaseCurrencyProvider(
122124
provider: (new ConfigurableProvider)->setExchangeRate(

0 commit comments

Comments
 (0)