Closed
Bug 1239622
Opened 8 years ago
Closed 8 years ago
Wrong Calendar Week range displayed for January 2021 in month view
Categories
(Calendar :: Calendar Frontend, defect)
Calendar
Calendar Frontend
Tracking
(Not tracked)
RESOLVED
FIXED
4.9
People
(Reporter: just4fun73de, Assigned: bv1578)
Details
Attachments
(1 file, 3 obsolete files)
3.37 KB,
patch
|
Fallen
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 Build ID: 20160105164030 Steps to reproduce: Select January 2021 in Calender with Month-View. Actual results: Shows "CWs: 1-4" Expected results: Should shows "CWs: 53-4"
Comment 1•8 years ago
|
||
please also give your version of calendar addon
Component: Untriaged → Calendar Views
Keywords: calendar-integration
Product: Thunderbird → Calendar
Version: 38 → unspecified
Component: Calendar Views → Untriaged
Product: Calendar → Thunderbird
Version: unspecified → 38
Updated•8 years ago
|
Component: Untriaged → Calendar Views
Product: Thunderbird → Calendar
Summary: Wrong Calendar Week → Wrong Calendar Week range displayed for January 2021 in month view
Version: 38 → unspecified
Confirmed. For the weeks interval showed in month view, it happens when displaying the January after a leap year that ends with a Thursday (e.g. 1/2021, 1/2049). Under those conditions the code normalizes twice the year-day of the Thursday in the week and transforms a valid 366 (week #53) into a 1 (week #1).
Assignee: nobody → bv1578
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #8708327 -
Flags: review?(philipp)
Comment 3•8 years ago
|
||
Comment on attachment 8708327 [details] [diff] [review] patch-v1 Review of attachment 8708327 [details] [diff] [review]: ----------------------------------------------------------------- The patch looks fine, but is unfortunately missing tests. I'd appreciate if you could write some. ::: calendar/base/src/calWeekInfoService.js @@ +76,5 @@ > var lastYearDate = aDateTime.clone(); > lastYearDate.year -= 1; > thisWeeksThursday += lastYearDate.endOfYear.yearday; > + } else if (thisWeeksThursday > aDateTime.endOfYear.yearday) { > + // For the last few days of the year, we already are in week 1. Can you remove the whitespace while you are here?
Attachment #8708327 -
Flags: review?(philipp) → review-
What about this? I've set the isDate property to true because this is the case when getWeekTitle() is used to dispaly the week interval in the navigation bar. Instead I've left the dates in UTC because the test didn't pass with ical.js when I set a timezone.
Attachment #8708327 -
Attachment is obsolete: true
Attachment #8711325 -
Flags: review?(philipp)
Sorry Philipp, I had attached the patch with the commands for the try-server in the summary.
Attachment #8711325 -
Attachment is obsolete: true
Attachment #8711325 -
Flags: review?(philipp)
Attachment #8711440 -
Flags: review?(philipp)
Comment 6•8 years ago
|
||
Comment on attachment 8711440 [details] [diff] [review] patch-v2 with test Review of attachment 8711440 [details] [diff] [review]: ----------------------------------------------------------------- Sorry about all the comments on the testcase. If you think it is redundant to check all 7 years I'd be fine with skipping a few. We just need to make sure it also keeps working for years not affected by this bug. ::: calendar/test/unit/test_weekinfo_service.js @@ +11,5 @@ > + [5, 1 , "19930101T000000Z"], // Start of week on Friday > + [1, 53, "20210101T000000Z"], // Start of week on Monday > + [5, 1 , "20210101T000000Z"], // Start of week on Friday > + [3, 53, "20490101T000000Z"], // Start of week on Wednesday > + [5, 1 , "20490101T000000Z"]]; // Start of week on Friday Can you add a few more test cases for years starting on other weekdays? In theory since there are only 7 years that have different weekday combinations, you should be able to check them all to make sure the results are correct. @@ +13,5 @@ > + [5, 1 , "20210101T000000Z"], // Start of week on Friday > + [3, 53, "20490101T000000Z"], // Start of week on Wednesday > + [5, 1 , "20490101T000000Z"]]; // Start of week on Friday > + > + for (let d of data) { You can use the following, then you don't have to use raw array indices: for (let [wkst, wknum, dtstr] of data) { Preferences.set("calendar.week.start", wkst); ... } @@ +14,5 @@ > + [3, 53, "20490101T000000Z"], // Start of week on Wednesday > + [5, 1 , "20490101T000000Z"]]; // Start of week on Friday > + > + for (let d of data) { > + Preferences.set("calendar.week.start", d[0]); Be sure to set this pref to the old value before the test ends to make sure no other tests are thrown off. @@ +19,5 @@ > + let date = cal.createDateTime(d[2]); > + date.isDate = true; > + let weekNumber = cal.getWeekInfoService().getWeekTitle(date); > + > + equal(weekNumber, d[1]); Maybe you can pass the third argument to describe the expected result, e.g. equal(weekNumber, wknum, "Week number matches for " + dtstr);
Attachment #8711440 -
Flags: review?(philipp) → review+
(In reply to Philipp Kewisch [:Fallen] from comment #6) > Sorry about all the comments on the testcase. Don't worry, all of them were necessary and useful. :) > Can you add a few more test cases for years starting on other weekdays? In > theory since there are only 7 years that have different weekday > combinations, you should be able to check them all to make sure the results > are correct. It depends also on the start of week but testing all the 7x7 possible combinations should be exaggerated given that the fix basically changes things only for a specific case. I've add 7 years that start on all the weekdays and used different start of week than Sunday for a few. I've also fixed all the points in the previous comment.
Attachment #8711440 -
Attachment is obsolete: true
Attachment #8711874 -
Flags: review?(philipp)
Comment 8•8 years ago
|
||
Comment on attachment 8711874 [details] [diff] [review] patch-v3 with test Review of attachment 8711874 [details] [diff] [review]: ----------------------------------------------------------------- This looks great, thanks! r=philipp
Attachment #8711874 -
Flags: review?(philipp) → review+
Pushed to comm-central http://hg.mozilla.org/comm-central/rev/bbc9245c4930 the version 4.9 is missing in the Target Milestone setting.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
OS: Windows 7 → All
Hardware: x86_64 → All
Resolution: --- → FIXED
Assignee | ||
Comment 10•8 years ago
|
||
@ Alex Thanks for the bug report.
Updated•8 years ago
|
Target Milestone: --- → 4.9
You need to log in
before you can comment on or make changes to this bug.
Description
•