From 475a7cc135db9be48ed79fa9234699ca634871df Mon Sep 17 00:00:00 2001 From: Vladimir Simakhin Date: Mon, 15 Jan 2024 16:16:47 +0100 Subject: [PATCH] fix round time error --- CHANGELOG.md | 4 ++++ cmd/web/templates/common-js.partials.gohtml | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ad0233..454b0c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [Unreleased] + +- Fix: time error for totals on the main `Logbook page` due to `round` function. Calculation didn't affect Stats or Logbook exports + ## [2.29.0] - 15.01.2024 - New: Additional sources for the airport databases. The new option added is from [https://ourairports.com](https://ourairports.com) diff --git a/cmd/web/templates/common-js.partials.gohtml b/cmd/web/templates/common-js.partials.gohtml index d87e22d..9558be8 100644 --- a/cmd/web/templates/common-js.partials.gohtml +++ b/cmd/web/templates/common-js.partials.gohtml @@ -78,6 +78,10 @@ wlbCommon = function () { if (minutes < 10) { minutes = "0" + minutes; } + if (minutes === 60) { + hours = hours + 1; + minutes = "00"; + } return hours + ":" + minutes; } @@ -99,7 +103,7 @@ wlbCommon = function () { var hours = parseInt(hoursMinutes[0], 10); var minutes = hoursMinutes[1] ? parseInt(hoursMinutes[1], 10) : 0; - return hours + Math.round(minutes / 60 * 100) / 100; + return hours + minutes / 60 ; } function escapeHtml(unsafe)