Bug 1545181 - Fix the "0 days" error in the task "Due In" column. r+a=philipp
authorPaul Morris <paul@paulwmorris.com>
Wed, 03 Jul 2019 13:58:12 -0400
changeset 34776 3355ea2d0afb1816d437f23dd53380dcc6d95926
parent 34775 b66546cb54de19a8540ea992d44720084f0534e5
child 34777 ebb463916466d22f7739f4c4e081b0ad07bc82bc
push id2451
push usermozilla@jorgk.com
push dateFri, 05 Jul 2019 08:25:14 +0000
treeherdercomm-beta@8e975ea6b3be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1545181
Bug 1545181 - Fix the "0 days" error in the task "Due In" column. r+a=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");