Bug 1872560 - Fix calculation of date one month ago when current date is in January causing perma test failures r=jsudiaman,fxview-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D197516
This commit is contained in:
Kelly Cochrane
2024-01-02 16:18:41 +00:00
parent 1526bae510
commit 2015711b58
2 changed files with 11 additions and 4 deletions
@@ -13,7 +13,7 @@ fail-if = ["a11y_checks"] # Bug 1854625 clicked .fxview-tab-row-secondary-button
["browser_firefoxview_virtual_list.js"]
["browser_history_firefoxview_next.js"]
skip-if = ["true"] # Bug 1872560
fail-if = ["a11y_checks"] # Bug 1854625 clicked button may not be focusable
["browser_opentabs_firefoxview_next.js"]
fail-if = ["a11y_checks"] # Bug 1854625 clicked .fxview-tab-row-secondary-button and panel-item may not be focusable
@@ -27,9 +27,16 @@ const twoDaysAgo = new Date(Date.now() - DAY_MS * 2);
const threeDaysAgo = new Date(Date.now() - DAY_MS * 3);
const fourDaysAgo = new Date(Date.now() - DAY_MS * 4);
const oneMonthAgo = new Date(today);
oneMonthAgo.setMonth(
oneMonthAgo.getMonth() === 0 ? 11 : oneMonthAgo.getMonth() - 1
);
// Set the date for the first day of the last month
oneMonthAgo.setDate(1);
if (oneMonthAgo.getMonth() === 0) {
// If today's date is in January, use first day in December from the previous year
oneMonthAgo.setMonth(11);
oneMonthAgo.setFullYear(oneMonthAgo.getFullYear() - 1);
} else {
oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1);
}
function isElInViewport(element) {
const boundingRect = element.getBoundingClientRect();