Skip to content

Commit

Permalink
fixed mm/in converter Met norway
Browse files Browse the repository at this point in the history
  • Loading branch information
PranshulGG committed Nov 23, 2024
1 parent 7258751 commit 7f86d3d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/src/main/assets/providers/met-norway.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ function renderHourlyDataMetNorway(data) {
const rainMeterBarItem = document.createElement('rainMeterBarItem');


let PrecAmount = `${hour.data.next_1_hours.details.precipitation_amount.toFixed(1)} mm`;

let PrecAmount;

if (SelectedPrecipitationUnit === 'in') {
PrecAmount = mmToInches(hour.data.next_1_hours.details.precipitation_amount).toFixed(2) + '';
} else {
PrecAmount = hour.data.next_1_hours.details.precipitation_amount.toFixed(1) + '';
}



Expand Down Expand Up @@ -139,8 +146,8 @@ function renderHourlyDataMetNorway(data) {
<rainPerBar>
<rainPerBarProgress style="height: ${Math.round(rainAmountPercent)}%; background-color: ${barColor};">
</rainPerBarProgress>
<p>${PrecAmount}</p>
</rainPerBar>
<p>${PrecAmount}</p>
<span>${hours}${period}</span>
`;

Expand Down

0 comments on commit 7f86d3d

Please sign in to comment.