Skip to content

Commit b90d9c7

Browse files
committed
Also convert "metric" temperature unit to degrees.
1 parent ab387eb commit b90d9c7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Cmfcmf/OpenWeatherMap/Util/Unit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ public function __toString()
8181
public function getUnit()
8282
{
8383
// Units are inconsistent. Only celsius and fahrenheit are not abbreviated. This check fixes that.
84-
if ($this->unit == 'celsius') {
84+
// Also, the API started to return "metric" as temperature unit recently. Also fix that.
85+
if ($this->unit == 'celsius' || $this->unit == 'metric') {
8586
return "°C";
8687
} else if ($this->unit == 'fahrenheit') {
8788
return 'F';

0 commit comments

Comments
 (0)