Bug 1545181 - Fix the "0 days" error in the task "Due In" column. r=philipp
authorPaul Morris <paul@paulwmorris.com>
Wed, 03 Jul 2019 13:58:12 -0400
changeset 36030 2a299189d89023de2a2a37a97815c9ee3f01867a
parent 36029 b48185ee97e6bf8494e60f10f69df0f49affa083
child 36031 5ce69de5c6c60edcb37c2b3e6242eb79cd8a6600
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersphilipp
bugs1545181
Bug 1545181 - Fix the "0 days" error in the task "Due In" column. r=philipp
calendar/base/content/calendar-task-tree.js
--- a/calendar/base/content/calendar-task-tree.js
+++ b/calendar/base/content/calendar-task-tree.js
@@ -373,19 +373,24 @@
             }
 
             const absSeconds = Math.abs(dur.inSeconds);
             const absMinutes = Math.ceil(absSeconds / 60);
             const prefix = dur.isNegative ? "-" : "";
 
             if (absMinutes >= 1440) {
                 // 1 day or more.
+                // Convert weeks to days; duration objects look like this (for 6, 7, and 8 days):
+                // { weeks: 0, days: 6 }
+                // { weeks: 1, days: 0 }
+                // { weeks: 0, days: 8 }
+                const days = dur.days + (dur.weeks * 7);
                 return prefix + PluralForm
-                    .get(dur.days, cal.l10n.getCalString("dueInDays"))
-                    .replace("#1", dur.days);
+                    .get(days, cal.l10n.getCalString("dueInDays"))
+                    .replace("#1", days);
             } else if (absMinutes >= 60) {
                 // 1 hour or more.
                 return prefix + PluralForm
                     .get(dur.hours, cal.l10n.getCalString("dueInHours"))
                     .replace("#1", dur.hours);
             } else {
                 // Less than one hour.
                 return cal.l10n.getCalString("dueInLessThanOneHour");