diff --git a/src/content.js b/src/content.js index b75640d..8f8dd02 100644 --- a/src/content.js +++ b/src/content.js @@ -36,8 +36,8 @@ const timeAgoLabels = { const debug = new URLSearchParams(window.location.search).get("jp-learn-microsoft-com-update-checker-debug"); - // Get data-article-date element in current page - const dataArticleDateElement = document.querySelector('time[data-article-date]'); + // Get local-time tag in current page + const dataArticleDateElement = document.querySelector('local-time'); if (!dataArticleDateElement) return; // Parse article date @@ -56,7 +56,7 @@ const timeAgoLabels = { const parser = new DOMParser(); const doc = parser.parseFromString(data, "text/html"); - const englishDateStr = doc.querySelector('time[data-article-date]')?.getAttribute("datetime"); + const englishDateStr = doc.querySelector('local-time')?.getAttribute("datetime"); if (!englishDateStr) return; const englishDate = new Date(englishDateStr); diff --git a/tests/e2e/content.e2e.test.js b/tests/e2e/content.e2e.test.js index 02d28f1..f83c670 100644 --- a/tests/e2e/content.e2e.test.js +++ b/tests/e2e/content.e2e.test.js @@ -100,8 +100,8 @@ describe('learn.microsoft.com Update Checker E2E Test', () => { }, testCase.themeColor); await page.waitForSelector('button[aria-pressed="true"]'); - // Wait for the time element with the 'data-article-date' attribute to be added - await page.waitForSelector('time[data-article-date]'); + // Wait for the time element with the 'local-time' attribute to be added + await page.waitForSelector('local-time'); const englishDateText = await page.evaluate((expectedText) => { return new Promise(resolve => setTimeout(resolve, 1000)) // Add a delay to allow time for the element to be added