[gnome-maps/wip/mlundblad/transit-duration-round] transitPlan: Round up duration to nearest minute
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/transit-duration-round] transitPlan: Round up duration to nearest minute
- Date: Sat, 26 Feb 2022 22:19:21 +0000 (UTC)
commit cceb09517e5128980c90573fa98ae498aedf1845
Author: Marcus Lundblad <ml update uu se>
Date: Sat Feb 26 23:12:57 2022 +0100
transitPlan: Round up duration to nearest minute
Round up duration value for display to the nearest
rounded up integer number of minutes, as displayed
departure time will be truncated down to the nearest
minute. This way the total number of minutes will always
match up instead of getting a rounding off-by-one
discrepancy in the case where the first leg has a
"partial" minute, and would be truncated down to the
next lower minute when showing the departure time.
src/transitPlan.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/transitPlan.js b/src/transitPlan.js
index b6556e0f..8b037bb9 100644
--- a/src/transitPlan.js
+++ b/src/transitPlan.js
@@ -319,7 +319,7 @@ class Itinerary extends GObject.Object {
}
prettyPrintDuration() {
- let mins = this.duration / 60;
+ let mins = Math.ceil(this.duration / 60);
if (mins < 60) {
let minStr = Utils.formatLocaleInteger(mins);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]