Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/content.e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down